Re: allow to \dtS+ pg_toast.*

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: allow to \dtS+ pg_toast.*
Date: 2020-12-18 17:33:12
Message-ID: 20201218173312.GZ30237@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 18, 2020 at 12:43:07PM +0100, Laurenz Albe wrote:
> On Fri, 2020-12-18 at 00:58 -0600, Justin Pryzby wrote:
> > On Thu, Dec 17, 2020 at 04:16:52PM +0100, Laurenz Albe wrote:
> > > On Mon, 2020-11-30 at 10:54 -0600, Justin Pryzby wrote:
> > > > This makes toast tables a bit less special and easier to inspect.
> > > >
> > > > postgres=# \dtS+ pg_toast.pg_toast_2619
> > > > pg_toast | pg_toast_2619 | toast table | pryzbyj | permanent | heap | 56 kB |
> > > >
> > > > This follows commit from last year:
> > > > | eb5472da9 make \d pg_toast.foo show its indices ; and, \d toast show its main table
> > >
> > > This would indeed be convenient.
> > >
> > > While playing around with it, I found the following oddity:
> > >
> > > regression=# \dtS pg_toast.pg_toast_30701
> > > pg_toast | pg_toast_30701 | toast table | laurenz
> > >
> > > regression=# \dt pg_toast.pg_toast_30701
> > > Did not find any relation named "pg_toast.pg_toast_30701".
> > >
> > > Now this doesn't seem right. To my understanding, \dtS should do the same as \dt,
> > > except that it should also search in "pg_catalog" if no schema was provided.
> >
> > You mean that if pg_toast.* should be shown if a matching "pattern" is given,
> > even if "S" was not used. I think you're right. The behavior I implemented
> > was intended to provide a bit of historic compatibility towards hiding toast
> > tables, but I think it's not needed, since they're not shown anyway unless
> > someone includes "S", specifies the "pg_toast." schema, or pg_toast is in their
> > search path. See attached.
>
> Yes, exactly.
>
> I wonder why the modification in "listPartitionedTables" is necessary.
> Surely there cannot be any partitioned toast tables, can there?

The comment should be removed for consistency.
And I changed the code for consistency with listTables (from which I assume
listPartitionedTables was derived - I was involved in the last stages of that
patch). It doesn't need to exclude pg_catalog or information_schema, either,
but it's kept the same for consistency. That part could also be removed.

> > > Another thing that is missing is tab completion for
> > > regression=# \dtS pg_toast.pg_
> > > This should work just like for \d and \dS.
..
> If I want to know how big the TOAST table of relation 87654 is,
> I think it is convenient if I can tab to
>
> \dt+ pg_toast.pg_toast_

I agree that it's nice to complete the schema name, but I'm still not convinced
this part should be included.

The way to include pg_toast.pg_toast is if toast relations are included, which
is exactly what Tom pointed out is usually unhelpful. If you include toast
relations, tab completion might give "pg_toast.pg_toast_14..." when you wanted
to paste "145678" - you'd need to remove the common suffix that it found.

I considered whether "toast table" should be capitalized (as it is for "\d")
but I think it should stay lowercase.

--
Justin

Attachment Content-Type Size
0001-Allow-to-dti-pg_toast.patch text/x-diff 5.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-12-18 17:54:39 Re: New Table Access Methods for Multi and Single Inserts
Previous Message Tom Lane 2020-12-18 17:20:33 Weird special case in jsonb_concat()