Re: allow to \dtS+ pg_toast.*

Laurenz Albe <laurenz.albe@cybertec.at>

From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers@postgresql.org
Date: 2020-12-17T15:16:52Z
Lists: pgsql-hackers
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.

The patch passes regression tests.

While playing around with it, I found the following oddity:

regression=# \dtS+ pg_toast.pg_toast_30701
                                            List of relations
  Schema  |      Name      |    Type     |  Owner  | Persistence | Access Method |  Size   | Description 
----------+----------------+-------------+---------+-------------+---------------+---------+-------------
 pg_toast | pg_toast_30701 | toast table | laurenz | permanent   | heap          | 0 bytes | 
(1 row)

regression=# \dtS pg_toast.pg_toast_30701
                 List of relations
  Schema  |      Name      |    Type     |  Owner  
----------+----------------+-------------+---------
 pg_toast | pg_toast_30701 | toast table | laurenz
(1 row)

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.

Another thing that is missing is tab completion for

regression=# \dtS pg_toast.pg_

This should work just like for \d and \dS.


Both of these effects can also be observed with \di and toast indexes.

Yours,
Laurenz Albe




Commits

  1. Revert unstable test cases from commit 7d80441d2.

  2. Allow psql's \dt and \di to show TOAST tables and their indexes.