Don't query PostgreSQL for the OIDs of an empty list of tables.

This commit is contained in:
Dimitri Fontaine 2013-11-24 16:43:59 +01:00
parent 81f5f95e1d
commit 451861cfd5

View File

@ -237,9 +237,10 @@ $$; " tables)))
(defun list-table-oids (table-names)
"Return an alist of (TABLE-NAME . TABLE-OID) for all table in the
TABLE-NAMES list. A connection must be established already."
(loop for (name oid)
in (pomo:query
(format nil
"select n, n::regclass::oid from (values ~{('~a')~^,~}) as t(n)"
table-names))
collect (cons name oid)))
(when table-names
(loop for (name oid)
in (pomo:query
(format nil
"select n, n::regclass::oid from (values ~{('~a')~^,~}) as t(n)"
table-names))
collect (cons name oid))))