Use the constraint name when we have it.

That's important for Citus, which doesn't know how to ADD a constraint
without a name.
This commit is contained in:
Dimitri Fontaine 2018-10-10 15:44:21 -07:00
parent 381ac9d1a2
commit 760763be4b

View File

@ -204,8 +204,9 @@
;; don't use the index schema name here, PostgreSQL doesn't
;; like it, might be implicit from the table's schema
;; itself...
"ALTER TABLE ~a ADD ~a USING INDEX ~a;"
"ALTER TABLE ~a ADD~@[ CONSTRAINT ~a~] ~a USING INDEX ~a;"
(format-table-name table)
(index-conname index)
(cond ((index-primary index) "PRIMARY KEY")
((index-unique index) "UNIQUE"))
index-name)))