Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Fix featureFunctionCheck. Part of #12.
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradHoeffner committed Mar 12, 2021
1 parent 789afe9 commit 084f23f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ create table feature_supports_function(
PRIMARY KEY (feature_suffix, function_suffix)
);

DROP FUNCTION IF EXISTS featureFunctionCheck;
DROP FUNCTION IF EXISTS featureFunctionCheck CASCADE;
CREATE FUNCTION featureFunctionCheck() RETURNS trigger AS $featureFunctionCheck$
DECLARE feature_type cataloguetype;
DECLARE function_type cataloguetype;
BEGIN

SELECT
feature.type AS feature_type,
function.type AS function_type
feature.type, function.type INTO feature_type, function_type
FROM feature_supports_function
JOIN citation feature ON feature.suffix=feature_supports_function.feature_suffix
JOIN citation function ON function.suffix=feature_supports_function.function_suffix;
Expand All @@ -199,6 +200,7 @@ END;
$featureFunctionCheck$ LANGUAGE plpgsql;
CREATE TRIGGER featureFunctionCheck BEFORE INSERT OR UPDATE ON feature_supports_function FOR EACH ROW EXECUTE PROCEDURE featureFunctionCheck();


-- ToDo: how to avoid circular reference? It would be complicated and of high cost to implement sth like a recursive query-monster, that points out the paths and checks if something is there twice.
-- I think the data are structured enough so we don't need this feature. For the stability of the db it has also no effect.
create table swp_has_child(
Expand Down

0 comments on commit 084f23f

Please sign in to comment.