Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ CREATE TRIGGER concept_propagate_derived_columns_trigger
FOR EACH ROW WHEN (NEW.is_schema AND OLD.literal_content IS DISTINCT FROM NEW.literal_content)
EXECUTE FUNCTION public.concept_propagate_derived_columns();

-- the trigger will propagate to instances
UPDATE public."Concept" SET is_relation=public.compute_is_relation_local(null::BIGINT, literal_content) WHERE is_schema;
-- do schemas first, so their values are correct for next step
UPDATE public."Concept" SET is_relation=public.compute_is_relation_local(null::BIGINT, literal_content) WHERE schema_id IS NULL;
UPDATE public."Concept" SET is_relation=public.compute_is_relation_local(null::BIGINT, literal_content) WHERE schema_id IS NOT NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Relation instances backfilled as non-relations

The second backfill statement targets instance concepts (schema_id IS NOT NULL) but calls compute_is_relation_local(null::BIGINT, ...), so each instance is judged by its own content instead of its schema's roles. Instances have no roles of their own, so every relation instance is stored as false, disagreeing with the trigger that derives the value from NEW.schema_id.

Suggested change
UPDATE public."Concept" SET is_relation=public.compute_is_relation_local(null::BIGINT, literal_content) WHERE schema_id IS NOT NULL;
UPDATE public."Concept" SET is_relation=public.compute_is_relation_local(schema_id, literal_content) WHERE schema_id IS NOT NULL;
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


ALTER TABLE public."Concept" ALTER COLUMN is_relation SET NOT NULL;