mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
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:
parent
9a0c50f700
commit
ad56cf808b
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user