Skip to content

Commit

Permalink
Comment clarifying query against pg_catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
espinafre committed Apr 26, 2020
1 parent 689bcc6 commit 304a3d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Expand Up @@ -652,6 +652,9 @@ def getTableConstraints(self, table):
version_number = int(self.getInfo()[0].split(' ')[1].split('.')[0])
con_col_name = 'consrc' if version_number < 12 else 'conbin'

# In the query below, we exclude rows where pg_constraint.contype whose values are equal to 't'
# because 't' describes a CONSTRAINT TRIGGER, which is not really a constraint in the traditional
# sense, but a special type of trigger, and an extension to the SQL standard.
sql = u"""SELECT c.conname, c.contype, c.condeferrable, c.condeferred, array_to_string(c.conkey, ' '), c.%s,
t2.relname, c.confupdtype, c.confdeltype, c.confmatchtype, array_to_string(c.confkey, ' ') FROM pg_constraint c
LEFT JOIN pg_class t ON c.conrelid = t.oid
Expand Down

0 comments on commit 304a3d9

Please sign in to comment.