File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
libraries/joomla/database/driver Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -391,7 +391,7 @@ public function getTableCreate($tables)
391391 /**
392392 * Retrieves field information about a given table.
393393 *
394- * @param string $table The name of the database table.
394+ * @param string $table The name of the database table. For PostgreSQL may start with a schema.
395395 * @param boolean $typeOnly True to only return field types.
396396 *
397397 * @return array An array of fields for the database table.
@@ -404,8 +404,18 @@ public function getTableColumns($table, $typeOnly = true)
404404 $ this ->connect ();
405405
406406 $ result = array ();
407-
408407 $ tableSub = $ this ->replacePrefix ($ table );
408+ $ fn = explode ('. ' , $ tableSub );
409+
410+ if (count ($ fn ) === 2 )
411+ {
412+ $ schema = $ fn [0 ];
413+ $ tableSub = $ fn [1 ];
414+ }
415+ else
416+ {
417+ $ schema = 'public ' ;
418+ }
409419
410420 $ this ->setQuery ('
411421 SELECT a.attname AS "column_name",
@@ -427,7 +437,7 @@ public function getTableColumns($table, $typeOnly = true)
427437 WHERE a.attrelid =
428438 (SELECT oid FROM pg_catalog.pg_class WHERE relname= ' . $ this ->quote ($ tableSub ) . '
429439 AND relnamespace = (SELECT oid FROM pg_catalog.pg_namespace WHERE
430- nspname = \' public \ ')
440+ nspname = ' . $ this -> quote ( $ schema ) . ')
431441 )
432442 AND a.attnum > 0 AND NOT a.attisdropped
433443 ORDER BY a.attnum '
You can’t perform that action at this time.
0 commit comments