Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmKT6-0001ei-J4 for pgadmin-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 12:48:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bmKT5-0000xp-Nr for pgadmin-hackers@arkaria.postgresql.org; Tue, 20 Sep 2016 12:48:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bmKT5-0000xi-4l for pgadmin-hackers@postgresql.org; Tue, 20 Sep 2016 12:48:11 +0000 Received: from mail-qt0-x230.google.com ([2607:f8b0:400d:c0d::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bmKT1-0006JT-1W for pgadmin-hackers@postgresql.org; Tue, 20 Sep 2016 12:48:10 +0000 Received: by mail-qt0-x230.google.com with SMTP id 93so6652975qtg.2 for ; Tue, 20 Sep 2016 05:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=P2IWeunJpsvmnYsocfFWxL6XE2bp8Sr6ZM6hgudGqCE=; b=vxM2OSo90bPspJXniZAR2Zul4796ZIYhOs8DLnZR85kqu51DcLW+06fOrnqOrnOLzq tVAL9k2onzXMjGN5UCVSbgXfrdKca+/MVNFYITqt9mHLD3pBxe8qGjaiO23vWzbpRXdA YWWXwLKj26vjhj6Hq1+pRLpv29rDZ1CKSU7fTbQWfqIrw7DJrqroeQ/hEJ4KVuRrLXpu z8A/b7xwmd9AaPp2gFv0evmCPoXw8vM3YDDirSXBg/LYZAJFNxw1SVDgMa/IoIlLL3cG Q2qbuhFusTUqzyhGbJKKXBwWMjXW12AUk+7DtpeIxMZlGO9Bd+m7bJTlKaVeNTZTWOH/ C1dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=P2IWeunJpsvmnYsocfFWxL6XE2bp8Sr6ZM6hgudGqCE=; b=hiKNpzeIYUcPvDO0be0LeCikAI9Wts4tWeR0uYeTzKnRvGzZO80AwwgkwqgKJleRLd DJBpwXNdozqnjCeEc1N0NLew/pVkLbMNLcrkY98jQXYr2j9ryPVSW4UBmqQ59/JL0mlD Crj1fz4/J21V8HCC9ms0IBJvH+EBB11c6pk23nTl3jahdvcVf5Mc0y88Zvhu9xHdQcLz ggkeawjcOubOjaNxjSp8RCVkRv1S4GsFXB1OlXfo8b/QFw8Y6PH6dA2QEjjp3gXrThhT X7NdjkVPzTDX4SYZCHlN4htcn9gO+dK1YlIPf0M9s2pbBVDh0DT4sI/U8f6CzDi1T0mK uEsA== X-Gm-Message-State: AE9vXwORtR0Hw7X+XwFY83pRdSWDASU+3v4ge23aP2pcD16TtZudb45Gc2HHd0IISy68FcaaYP3/jmE6wFzFkA== X-Received: by 10.200.35.44 with SMTP id a41mr35550027qta.25.1474375684669; Tue, 20 Sep 2016 05:48:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.51.231 with HTTP; Tue, 20 Sep 2016 05:48:02 -0700 (PDT) In-Reply-To: References: From: Magnus Hagander Date: Tue, 20 Sep 2016 07:48:02 -0500 Message-ID: Subject: Re: pgAdmin 4 commit: Add classid filter to queries on pg_depend. Fixes #17 To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary=001a113df2aaf38c73053cefd6fc X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --001a113df2aaf38c73053cefd6fc Content-Type: text/plain; charset=UTF-8 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 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 > > 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 (pgadmin-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers > --001a113df2aaf38c73053cefd6fc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks!

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

I= n working on this I also noticed that we fairly often use the construct of = "(select oid from pg_class where relname=3Dxxx)" instead of using= "::regclass". This could cause issues if somebody creates a tabl= e with the same name in a different schema, for example. While not the high= est priority, it might be a good idea to go over the queries and replace th= ose 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 coup= le of cases where oid's are hardcoded, which is probably also a bad pra= ctice that needs to be taken care of.

//Magnus


On Fri= , Sep 16, 2016 at 5:24 AM, Dave Page <dpage@pgadmin.org> wro= te:
Add classid filter to queries on pg_d= epend. 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 s= ame oid (which is perfectly valid, as they are in different tables), a colu= mn will suddenly refer sequences that are completely incorrect. When we loo= k up sequences, we have to make sure we only match dependencies against pg_= class.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=3Dpgadmin4.git;a=3Dco= mmitdiff;h=3Dce20dbc25a393004c5249d946f9a85a691cacd48
Author: Magnus Hagander <magnus@h= agander.net>

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


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-ha= ckers


--001a113df2aaf38c73053cefd6fc--