summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2021-01-25 15:24:32 +0100
committerNathan Gass2021-01-25 15:24:32 +0100
commita39d9275bf2fb694560eef64d0afebecf141bc28 (patch)
treea5c68c31f80996f0817e8f3674215049d1c12f19
parent6ebf739b59022622033d4face9db3cb6988121f1 (diff)
downloaditools-a39d9275bf2fb694560eef64d0afebecf141bc28.tar.gz
itools-a39d9275bf2fb694560eef64d0afebecf141bc28.tar.bz2
itools-a39d9275bf2fb694560eef64d0afebecf141bc28.zip
fix 850c9fd: do not presume public schema if none is given (for example temp tables have their own schema)
-rw-r--r--it_dbi_postgres.class2
1 files changed, 1 insertions, 1 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class
index fd45f46..1161632 100644
--- a/it_dbi_postgres.class
+++ b/it_dbi_postgres.class
@@ -57,7 +57,7 @@ function _tables($p = array())
function _get_field_defs()
{
list($table_name, $table_schema) = array_reverse(explode('.', $this->_p['table'], 2));
- $where = $this->_where(['t.table_name' => $table_name, 't.table_schema' => $table_schema ?: 'public', 't.table_catalog' => $this->_p['db']]);
+ $where = $this->_where(['t.table_name' => $table_name, 't.table_catalog' => $this->_p['db']] + ($table_schema ? ['t.table_schema' => $table_schema] : []));
# Recreate Key column of mysql show columns
$res = $this->query('SELECT column_name,constraint_type,ordinal_position FROM information_schema.table_constraints AS t JOIN information_schema.key_column_usage USING (constraint_name, constraint_schema, constraint_catalog) ' . $where);