Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5xDp-0007Fh-Qa for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 21:56:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5xDn-0007eo-Nj for pgsql-hackers@arkaria.postgresql.org; Fri, 07 Jan 2022 21:56:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5xDn-0007ee-96 for pgsql-hackers@lists.postgresql.org; Fri, 07 Jan 2022 21:56:27 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n5xDk-0003Gh-Gf for pgsql-hackers@lists.postgresql.org; Fri, 07 Jan 2022 21:56:26 +0000 Received: by mail-il1-x131.google.com with SMTP id d3so5628358ilr.10 for ; Fri, 07 Jan 2022 13:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JqT6edqInRR7RlZjUxExYuFtFcPVXeA9v/CTop3CtUk=; b=uxzEzSRmkk8aIHMYWp/ZyfShbpcdGeXhUXOBAiftTdkUI0o6gemdcvwUtat/ob926y 5gB1JdZRHJFRZmJjWmcBs9LM4WhXdX2C8AjwITSGgbdtfK2L7EqYpECKF51IxQ1dMiAo K+O8gDp2pRR+LHMhSywnTLezn+eqVr8uLRw784VBtNt3Chso8VLBzqV92nGGun+vMixq Tj0xCtrjYOHeiicXp/ARcdYnxFlcyNYMy9spoGLrdKEubJX+pyqn0zIyZ0V4bDJpqw68 fMeSd/cS4QuiPHViFkqJk2y6VTc5Xd9QGMHP+jzsaoGlrmfFIswynYlO4BCZ+Qc3lZl1 QmuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JqT6edqInRR7RlZjUxExYuFtFcPVXeA9v/CTop3CtUk=; b=KPDeFITIneLpLifgk/hynhZ3ZtwrYMcBp9lJOJ4mNPWr5N0qxK8s4uJCZfYLejXarb DakBpf9vjfSjuiqoat77p6Gv3qVC+nJ7lyfZGgrMGy+0teYcw9GVVOLTBe0xxKQfXSqy 8/ZNBSJIQjctivYtk+WTLk3W7XOck6tR8BfUIMqguClyS6u8JdBls0BDqr1GzNPZ4cHM Z/Avcp1FFZ6nNbjTKxiBf/zdDOmcYoD4CORjw4Bbuwl8pQlmPWZbkMLVlc/bptUpA+x5 99YZZYQWitCZHIO9szVPNgRduZ2HRdq8VCHYgW/7Ee/dv+k4iwMXViprBEl3lxRy1t5K 67lg== X-Gm-Message-State: AOAM532DlLHsUqHaxxLCVOKBkuIeSa3bacizgdMcpVNyjOFAd23KCRnY JRkUyZOAkM1GvVbM9h/YOJZ+AA== X-Google-Smtp-Source: ABdhPJwK7btIeliprAjXnseTBiz8DQoX4ED41+o66/ptcZAUaHUaaYD3IV8yngc1sFeZe+Toizc6LQ== X-Received: by 2002:a92:6406:: with SMTP id y6mr31496354ilb.179.1641592582443; Fri, 07 Jan 2022 13:56:22 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id a19sm216427ilf.43.2022.01.07.13.56.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jan 2022 13:56:21 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 82C31800DF5; Fri, 7 Jan 2022 15:56:20 -0600 (CST) Date: Fri, 7 Jan 2022 15:56:20 -0600 From: Justin Pryzby To: Michael Paquier Cc: Tatsuro Yamada , =?iso-8859-1?Q?=C1lvaro?= Herrera , Magnus Hagander , pgsql-hackers@lists.postgresql.org, Tomas Vondra , pgsql-hackers@postgresql.org, Alvaro Herrera Subject: Re: \dP and \dX use ::regclass without "pg_catalog." Message-ID: <20220107215620.GH14051@telsasoft.com> References: <20220107022235.GA14051@telsasoft.com> <1b7d4248-a96d-6e5c-bde9-d7d5584e7448@nttcom.co.jp> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="TD8GDToEDw0WLGOL" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TD8GDToEDw0WLGOL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Jan 07, 2022 at 08:08:57PM +0900, Michael Paquier wrote: > On Fri, Jan 07, 2022 at 06:30:30PM +0900, Tatsuro Yamada wrote: > > We should prefix them with pg_catalog as well. > > Are you planning to make a patch? > > If not, I'll make a patch later since that's where \dX is. > > If any of you can make a patch, that would be great. Thanks! I'd propose these. --TD8GDToEDw0WLGOL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-psql-qualify-text-with-pg_catalog.patch" From d1e337daf81faa9a0a8c33a26091cbae396df7bb Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Thu, 6 Jan 2022 20:23:52 -0600 Subject: [PATCH 1/3] psql: qualify ::text with pg_catalog backpatch to v14 --- src/bin/psql/describe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 7cbf5f7b105..b3fbff1a0c3 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -4392,7 +4392,7 @@ listExtendedStats(const char *pattern) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, "SELECT \n" - "es.stxnamespace::pg_catalog.regnamespace::text AS \"%s\", \n" + "es.stxnamespace::pg_catalog.regnamespace::pg_catalog.text AS \"%s\", \n" "es.stxname AS \"%s\", \n", gettext_noop("Schema"), gettext_noop("Name")); @@ -4439,7 +4439,7 @@ listExtendedStats(const char *pattern) processSQLNamePattern(pset.db, &buf, pattern, false, false, - "es.stxnamespace::pg_catalog.regnamespace::text", "es.stxname", + "es.stxnamespace::pg_catalog.regnamespace::pg_catalog.text", "es.stxname", NULL, "pg_catalog.pg_statistics_obj_is_visible(es.oid)"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); -- 2.17.1 --TD8GDToEDw0WLGOL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-psql-order-a-relation-s-extended-statistics-by-name.patch" From 5033095abb3631bf01e4213752d5a4d3a24896fa Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Thu, 6 Jan 2022 20:25:07 -0600 Subject: [PATCH 2/3] psql: order a relation's extended statistics by name.. like \dX not by OID v15 only? --- src/bin/psql/describe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index b3fbff1a0c3..daf06bbcc81 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2608,7 +2608,7 @@ describeOneTableDetails(const char *schemaname, printfPQExpBuffer(&buf, "SELECT oid, " "stxrelid::pg_catalog.regclass, " - "stxnamespace::pg_catalog.regnamespace AS nsp, " + "stxnamespace::pg_catalog.regnamespace::pg_catalog.text AS nsp, " "stxname,\n" "pg_catalog.pg_get_statisticsobjdef_columns(oid) AS columns,\n" " 'd' = any(stxkind) AS ndist_enabled,\n" @@ -2617,7 +2617,7 @@ describeOneTableDetails(const char *schemaname, "stxstattarget\n" "FROM pg_catalog.pg_statistic_ext stat\n" "WHERE stxrelid = '%s'\n" - "ORDER BY 1;", + "ORDER BY nsp, stxname;", oid); result = PSQLexec(buf.data); -- 2.17.1 --TD8GDToEDw0WLGOL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0003-Remove-unused-table-alias.patch" From 020f425c7ed67183275d64f19c34f69d63b8ddc6 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Fri, 7 Jan 2022 15:48:46 -0600 Subject: [PATCH 3/3] Remove unused table alias --- src/bin/psql/describe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index daf06bbcc81..c62d3bd4f8a 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -2615,7 +2615,7 @@ describeOneTableDetails(const char *schemaname, " 'f' = any(stxkind) AS deps_enabled,\n" " 'm' = any(stxkind) AS mcv_enabled,\n" "stxstattarget\n" - "FROM pg_catalog.pg_statistic_ext stat\n" + "FROM pg_catalog.pg_statistic_ext\n" "WHERE stxrelid = '%s'\n" "ORDER BY nsp, stxname;", oid); @@ -2719,7 +2719,7 @@ describeOneTableDetails(const char *schemaname, appendPQExpBufferStr(&buf, " stxstattarget\n"); else appendPQExpBufferStr(&buf, " -1 AS stxstattarget\n"); - appendPQExpBuffer(&buf, "FROM pg_catalog.pg_statistic_ext stat\n" + appendPQExpBuffer(&buf, "FROM pg_catalog.pg_statistic_ext\n" "WHERE stxrelid = '%s'\n" "ORDER BY 1;", oid); -- 2.17.1 --TD8GDToEDw0WLGOL--