Skip to content

Comments

Support for EXCLUDE USING#4

Open
deem0n wants to merge 3 commits intojuliendelplanque:masterfrom
deem0n:master
Open

Support for EXCLUDE USING#4
deem0n wants to merge 3 commits intojuliendelplanque:masterfrom
deem0n:master

Conversation

@deem0n
Copy link

@deem0n deem0n commented Jan 29, 2019

Hi, I just tried your code on the production database with 10,000 objects. Seems exclude constraints were not yet implemented, so here is my attempt to fix it. I am not as efficient with Smalltalk as with PL/pgSQL ;-)

With this fix I have loaded all objects from the DB fine!

@deem0n
Copy link
Author

deem0n commented Jan 29, 2019

Also, pg_constraint.conkey may have colIndex = 0. That means that a function was used.
like in this snippet:

ALTER TABLE vcp.attachments
ADD CONSTRAINT unique_vcp_attachment_task_constr
EXCLUDE USING gist (dataset_id WITH =, metric_id WITH =, location_id WITH =,
   period_type WITH =, user_id WITH =, assignee_id WITH =,
  tstzrange(start_time, expiration_time, '()') WITH &&)
WHERE (attachment_type = 'vcp-task');

tstzrange(start_time, expiration_time, '()') WITH && will be referenced as column with index 0

@juliendelplanque
Copy link
Owner

Hello,

First of all, thank you very much for your contribution!

I'm happy to read that you were able to import your schema.

Your change seems to be ok but there are several details to fix:

  • FmxSQLExclusionConstraint should not be hand-written. In fact the classes forming the meta-model are generated from a script (this is the way the meta-modelling framework works). I can help you to write the part of the script generating this constraint.
  • The objects with Sql as prefix are part of another project on which depends FamixNGSQL, PgMetadata (https://github.com/olivierauverlot/PgMetadata). So SqlExclusionConstraint should be committed there.

@deem0n
Copy link
Author

deem0n commented Feb 11, 2019

Julien, I definitely need help with FmxSQLExclusionConstraint magic and will rework SqlExclusionConstraint moving it into correct repo.

@deem0n
Copy link
Author

deem0n commented Feb 14, 2019

Hi, added SqlExtrusionConstraint into PgMetadata: olivierauverlot/PgMetadata#9

@deem0n
Copy link
Author

deem0n commented Feb 22, 2019

Hi, it was merged into PgMetadata: olivierauverlot/PgMetadata#9

Any advise on next steps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants