From 760763be4bb4cc7b45130727a2c303a79943c112 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 10 Oct 2018 15:44:21 -0700 Subject: [PATCH] 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. --- src/pgsql/pgsql-ddl.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pgsql/pgsql-ddl.lisp b/src/pgsql/pgsql-ddl.lisp index 580618e..662bc95 100644 --- a/src/pgsql/pgsql-ddl.lisp +++ b/src/pgsql/pgsql-ddl.lisp @@ -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)))