diff options
author | Nathan Gass | 2021-01-08 15:41:40 +0100 |
---|---|---|
committer | Nathan Gass | 2021-01-08 15:42:35 +0100 |
commit | 850c9fd1e027c736c7ba1fb1ed5bce1acb3d6a38 (patch) | |
tree | 01be7266710b40e83e475675107fafb7ef3f4538 | |
parent | 815a8c57d71016eb5b23d355f9685173ceaab789 (diff) | |
download | itools-850c9fd1e027c736c7ba1fb1ed5bce1acb3d6a38.tar.gz itools-850c9fd1e027c736c7ba1fb1ed5bce1acb3d6a38.tar.bz2 itools-850c9fd1e027c736c7ba1fb1ed5bce1acb3d6a38.zip |
handle schemas in table names
-rw-r--r-- | it_dbi_postgres.class | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/it_dbi_postgres.class b/it_dbi_postgres.class index 9192948..46c0393 100644 --- a/it_dbi_postgres.class +++ b/it_dbi_postgres.class @@ -52,7 +52,8 @@ function _tables($p = array()) function _get_field_defs() { - $where = $this->_where(['t.table_name' => $this->_p['table'], 't.table_catalog' => $this->_p['db']]); + 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']]); // 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); |