mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-09 12:38:35 -05:00
Use schema qualification while accessing the catalog objects. Fixes #3976
This commit is contained in:
committed by
Akshay Joshi
parent
8cf7c41ad9
commit
a2be30d257
@@ -609,8 +609,8 @@ def fetch_pg_types(columns_info, trans_obj):
|
||||
|
||||
if oids:
|
||||
status, res = default_conn.execute_dict(
|
||||
"SELECT oid, format_type(oid, NULL) AS typname FROM pg_type "
|
||||
"WHERE oid IN %s ORDER BY oid;", [tuple(oids)]
|
||||
"SELECT oid, pg_catalog.format_type(oid, NULL) AS typname FROM "
|
||||
"pg_catalog.pg_type WHERE oid IN %s ORDER BY oid;", [tuple(oids)]
|
||||
)
|
||||
|
||||
if not status:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{# ============= Fetch the primary keys for given object id ============= #}
|
||||
{% if obj_id %}
|
||||
SELECT at.attname, at.attnum, ty.typname
|
||||
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
|
||||
FROM pg_catalog.pg_attribute at LEFT JOIN pg_catalog.pg_type ty ON (ty.oid = at.atttypid)
|
||||
WHERE attrelid={{obj_id}}::oid AND attnum = ANY (
|
||||
(SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid
|
||||
(SELECT con.conkey FROM pg_catalog.pg_class rel LEFT OUTER JOIN pg_catalog.pg_constraint con ON con.conrelid=rel.oid
|
||||
AND con.contype='p' WHERE rel.relkind IN ('r','s','t', 'p') AND rel.oid = {{obj_id}}::oid)::oid[])
|
||||
{% endif %}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{# ============= Fetch the columns ============= #}
|
||||
{% if obj_id %}
|
||||
SELECT at.attname, ty.typname, at.attnum
|
||||
FROM pg_attribute at
|
||||
LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
|
||||
FROM pg_catalog.pg_attribute at
|
||||
LEFT JOIN pg_catalog.pg_type ty ON (ty.oid = at.atttypid)
|
||||
WHERE attrelid={{obj_id}}::oid
|
||||
AND at.attnum > 0
|
||||
AND at.attisdropped = FALSE
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{# ============= Check object has OIDs or not ============= #}
|
||||
{% if obj_id %}
|
||||
SELECT rel.relhasoids AS has_oids
|
||||
FROM pg_class rel
|
||||
FROM pg_catalog.pg_class rel
|
||||
WHERE rel.oid = {{ obj_id }}::oid
|
||||
{% endif %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{# ============= Fetch the schema and object name for given object id ============= #}
|
||||
{% if obj_id %}
|
||||
SELECT n.nspname, r.relname
|
||||
FROM pg_class r
|
||||
LEFT JOIN pg_namespace n ON (r.relnamespace = n.oid)
|
||||
FROM pg_catalog.pg_class r
|
||||
LEFT JOIN pg_catalog.pg_namespace n ON (r.relnamespace = n.oid)
|
||||
WHERE r.oid = {{obj_id}};
|
||||
{% endif %}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{# ============= Fetch the primary keys for given object id ============= #}
|
||||
{% if obj_id %}
|
||||
SELECT at.attname, at.attnum, ty.typname
|
||||
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
|
||||
FROM pg_catalog.pg_attribute at LEFT JOIN pg_catalog.pg_type ty ON (ty.oid = at.atttypid)
|
||||
WHERE attrelid={{obj_id}}::oid AND attnum = ANY (
|
||||
(SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid
|
||||
(SELECT con.conkey FROM pg_catalog.pg_class rel LEFT OUTER JOIN pg_catalog.pg_constraint con ON con.conrelid=rel.oid
|
||||
AND con.contype='p' WHERE rel.relkind IN ('r','s','t') AND rel.oid = ({{obj_id}})::oid)::oid[])
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user