Fix PostgreSQL index naming.

A PostgreSQL index is always created in the same schema as the table it
is defined against, and the CREATE INDEX command doesn't accept schema
qualified index names.
This commit is contained in:
Dimitri Fontaine 2016-12-18 19:18:26 +01:00
parent 9a0c50f700
commit ad56cf808b

View File

@ -154,8 +154,7 @@
;; LOCK on the table before we have the index done already
(or (index-sql index)
(format stream
"CREATE UNIQUE INDEX ~@[~a.~]~a ON ~a (~{~a~^, ~})~@[ WHERE ~a~];"
(when (index-schema index) (schema-name (index-schema index)))
"CREATE UNIQUE INDEX ~a ON ~a (~{~a~^, ~})~@[ WHERE ~a~];"
index-name
(format-table-name table)
(index-columns index)
@ -178,9 +177,8 @@
(t
(or (index-sql index)
(format stream
"CREATE~:[~; UNIQUE~] INDEX ~@[~a.~]~a ON ~a (~{~a~^, ~})~@[ WHERE ~a~];"
"CREATE~:[~; UNIQUE~] INDEX ~a ON ~a (~{~a~^, ~})~@[ WHERE ~a~];"
(index-unique index)
(when (index-schema index) (schema-name (index-schema index)))
index-name
(format-table-name table)
(index-columns index)