Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Respect namespace in foreign keys (thanks to Kleps Ota)

  • Loading branch information...
commit 543e1725138e80f1d5259d0a82db0c33c921305b 1 parent 841cbbb
@vrana authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  adminer/drivers/pgsql.inc.php
View
2  adminer/drivers/pgsql.inc.php
@@ -276,7 +276,7 @@ function foreign_keys($table) {
$return = array();
foreach (get_rows("SELECT conname, pg_get_constraintdef(oid) AS definition
FROM pg_constraint
-WHERE conrelid = (SELECT oid FROM pg_class WHERE relname = " . q($table) . ")
+WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS pn ON (pn.oid = pc.relnamespace) WHERE pc.relname = " . q($table) . " AND pn.nspname = current_schema())
AND contype = 'f'::char
ORDER BY conkey, conname") as $row) {
if (preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA', $row['definition'], $match)) {
Please sign in to comment.
Something went wrong with that request. Please try again.