Citus support small bug fixes.

When calling the create_distributed_table() function, the column name is
given as a literal parameter to the function and should be quoted that way,
with single quotes. In particular, if our column-name is already
double-quoted, we need to get rid of those extra quotes.

Also, the source-table-name might be a cons object when qualified, or a
plain string when not schema-qualified. Adjust the citus-find-table code to
take that into account.
This commit is contained in:
Dimitri Fontaine 2019-02-16 15:48:46 +01:00
parent 2e6a941d25
commit 7c146c46b9
2 changed files with 5 additions and 2 deletions

View File

@ -17,4 +17,4 @@
(rule-col-name (column-name (citus-distributed-rule-using rule))))
(format stream "SELECT create_distributed_table('~a', '~a');"
(format-table-name rule-table)
(apply-identifier-case rule-col-name))))
(ensure-unquoted rule-col-name))))

View File

@ -70,7 +70,10 @@
table-name schema-name))))))
(defun citus-find-table (catalog table)
(let* ((table-name (cdr (table-source-name table)))
(let* ((source-name (table-source-name table))
(table-name (etypecase source-name
(string source-name)
(cons (cdr source-name))))
(schema-name (schema-name (table-schema table))))
(or (find-table (find-schema catalog schema-name) table-name)
(error (make-condition 'citus-rule-table-not-found