public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Gustafsson <[email protected]>
To: [email protected]
Subject: Fix projection of pg_type for Greenplum query
Date: Tue, 23 Jul 2019 10:13:00 +0200
Message-ID: <[email protected]> (raw)
The bug in https://redmine.postgresql.org/issues/4179 seems to be due to
pg_type being projected from but not selected, the attached patch adds a FROM
clause entry and also adds projection of typname. This makes the query work on
5X_STABLE for me.
cheers ./daniel
Attachments:
[application/octet-stream] from_pg_type.patch (2.2K, 2-from_pg_type.patch)
download | inline diff:
From a18d1948d845f1a7b6a3603543d0b951f93b5839 Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <[email protected]>
Date: Tue, 23 Jul 2019 10:08:59 +0200
Subject: [PATCH] Fix properties query for Greenplum
The query projected a column from pg_catalog.pg_class but didn't
include it in the FROM clause. Fix by adding a LEFT OUTER JOIN on
the catalog relation and also promote typname to a projection as
it might be available.
Fixes https://redmine.postgresql.org/issues/4179
---
.../schemas/tables/templates/tables/sql/gpdb_5.0_plus/properties.sql | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/gpdb_5.0_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/gpdb_5.0_plus/properties.sql
index c690a1b8..ca7231ac 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/gpdb_5.0_plus/properties.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/gpdb_5.0_plus/properties.sql
@@ -59,7 +59,7 @@ FROM (
substring(array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
array_to_string(rel.reloptions, ',') AS table_vacuum_settings_str,
array_to_string(tst.reloptions, ',') AS toast_table_vacuum_settings_str,
- rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, NULL AS reloftype, NULL AS typname,
+ rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, NULL AS reloftype, typ.typname AS typname,
typ.typrelid AS typoid,
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
-- Added for pgAdmin4
@@ -79,6 +79,7 @@ FROM (
LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid AND con.contype='p'
LEFT OUTER JOIN pg_class tst ON tst.oid = rel.reltoastrelid
LEFT OUTER JOIN gp_distribution_policy gdp ON gdp.localoid = rel.oid
+ LEFT OUTER JOIN pg_type typ ON typ.oid = rel.reltype
WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}
{% if tid %} AND rel.oid = {{ tid }}::oid {% endif %}
--
2.14.1.145.gb3622a4ee
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Fix projection of pg_type for Greenplum query
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox