Re: output columns of \dAo and \dAp

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: output columns of \dAo and \dAp
Date: 2020-07-13 12:44:45
Message-ID: CAPpHfduj9KSxGFMVR3wDNHosxTM71mqT3D5h-2pGpxi=3P2jQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 11, 2020 at 10:59 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alexander Korotkov <aekorotkov(at)gmail(dot)com> writes:
> > The proposed patch is attached. This patch is fixes two points:
> > * Adds strategy number and purpose to output of \dAo
> > * Renames "Left/right arg type" columns of \dAp to "Registered left/right type"
>
> I think that \dAp should additionally be changed to print the
> function via "oid::regprocedure", not just proname. A possible
> compromise, if you think that's too wordy, is to do it that
> way for "\dAp+" while printing plain proname for "\dAp".

Good compromise. Done as you proposed.

> BTW, isn't this:
>
> " format ('%%s (%%s, %%s)',\n"
> " CASE\n"
> " WHEN pg_catalog.pg_operator_is_visible(op.oid) \n"
> " THEN op.oprname::pg_catalog.text \n"
> " ELSE o.amopopr::pg_catalog.regoper::pg_catalog.text \n"
> " END,\n"
> " pg_catalog.format_type(o.amoplefttype, NULL),\n"
> " pg_catalog.format_type(o.amoprighttype, NULL)\n"
> " ) AS \"%s\"\n,"
>
> just an extremely painful way to duplicate the results of regoperator?
> (You could likely remove the joins to pg_proc and pg_operator altogether
> if you relied on regprocedure and regoperator casts.)

Yeah, this subquery is totally dumb. Replaced with cast to regoperator.

> > I'm not yet convinced we should change the sort key for \dAo.
>
> After playing with this more, I'm less worried about that than
> I was. I think I was concerned that the operator name would
> sort ahead of amopstrategy, but now I see that the op name isn't
> part of the sort key at all.

Ok.

> BTW, these queries seem inadequately schema-qualified, notably
> the format() calls.

Thank you for pointing. I've added schema-qualification to pg_catalog
functions and tables.

------
Regards,
Alexander Korotkov

Attachment Content-Type Size
0001-Improvements-to-psql-dAo-and-dAp-commands-2.patch application/octet-stream 18.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-07-13 12:52:12 Re: Editing errors in the comments of tableam.h and heapam.c
Previous Message Hironobu SUZUKI 2020-07-13 12:25:39 Editing errors in the comments of tableam.h and heapam.c