public inbox for [email protected]  
help / color / mirror / Atom feed
pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17
2+ messages / 2 participants
[nested] [flat]

* pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17
@ 2016-09-16 10:24 Dave Page <[email protected]>
  2016-09-20 12:48 ` Re: pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17 Magnus Hagander <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Dave Page @ 2016-09-16 10:24 UTC (permalink / raw)
  To: pgadmin-hackers

Add classid filter to queries on pg_depend. Fixes #1705

There are a number of cases where queries in both pgadmin4 and pgadmin3 are done against pg_depend but falis to constrain the query on classid.

In particular, if for example a constraint and a sequence exists with the same oid (which is perfectly valid, as they are in different tables), a column will suddenly refer sequences that are completely incorrect. When we look up sequences, we have to make sure we only match dependencies against pg_class.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=ce20dbc25a393004c5249d946f9a85a691cac...
Author: Magnus Hagander <[email protected]>

Modified Files
--------------
.../columns/templates/catalog_object_column/sql/9.1_plus/properties.sql | 2 +-
.../schemas/tables/templates/column/sql/9.1_plus/is_referenced.sql      | 1 +
.../databases/schemas/tables/templates/column/sql/9.1_plus/nodes.sql    | 2 +-
.../schemas/tables/templates/column/sql/9.1_plus/properties.sql         | 2 +-
.../schemas/tables/templates/column/sql/9.2_plus/is_referenced.sql      | 1 +
.../databases/schemas/tables/templates/column/sql/9.2_plus/nodes.sql    | 2 +-
.../schemas/tables/templates/column/sql/9.2_plus/properties.sql         | 2 +-
7 files changed, 7 insertions(+), 5 deletions(-)


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17
  2016-09-16 10:24 pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17 Dave Page <[email protected]>
@ 2016-09-20 12:48 ` Magnus Hagander <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Magnus Hagander @ 2016-09-20 12:48 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

Thanks!

I'll push a backpatch of this to pgadmin3 as well, just in case somebody
wants to build their own version even if there are no more official
releases.

In working on this I also noticed that we fairly often use the construct of
"(select oid from pg_class where relname=xxx)" instead of using
"::regclass". This could cause issues if somebody creates a table with the
same name in a different schema, for example. While not the highest
priority, it might be a good idea to go over the queries and replace those
patterns (and if we're doing that, it's probably not a bad idea to fully
qualify them as well, as we don in psql). There's also a couple of cases
where oid's are hardcoded, which is probably also a bad practice that needs
to be taken care of.

//Magnus


On Fri, Sep 16, 2016 at 5:24 AM, Dave Page <[email protected]> wrote:

> Add classid filter to queries on pg_depend. Fixes #1705
>
> There are a number of cases where queries in both pgadmin4 and pgadmin3
> are done against pg_depend but falis to constrain the query on classid.
>
> In particular, if for example a constraint and a sequence exists with the
> same oid (which is perfectly valid, as they are in different tables), a
> column will suddenly refer sequences that are completely incorrect. When we
> look up sequences, we have to make sure we only match dependencies against
> pg_class.
>
> Branch
> ------
> master
>
> Details
> -------
> http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=
> ce20dbc25a393004c5249d946f9a85a691cacd48
> Author: Magnus Hagander <[email protected]>
>
> Modified Files
> --------------
> .../columns/templates/catalog_object_column/sql/9.1_plus/properties.sql |
> 2 +-
> .../schemas/tables/templates/column/sql/9.1_plus/is_referenced.sql      |
> 1 +
> .../databases/schemas/tables/templates/column/sql/9.1_plus/nodes.sql    |
> 2 +-
> .../schemas/tables/templates/column/sql/9.1_plus/properties.sql         |
> 2 +-
> .../schemas/tables/templates/column/sql/9.2_plus/is_referenced.sql      |
> 1 +
> .../databases/schemas/tables/templates/column/sql/9.2_plus/nodes.sql    |
> 2 +-
> .../schemas/tables/templates/column/sql/9.2_plus/properties.sql         |
> 2 +-
> 7 files changed, 7 insertions(+), 5 deletions(-)
>
>
> --
> Sent via pgadmin-hackers mailing list ([email protected])
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-09-20 12:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 10:24 pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17 Dave Page <[email protected]>
2016-09-20 12:48 ` Magnus Hagander <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox