Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions (and tablespace)

Поиск
Список
Период
Сортировка
От Justin Pryzby
Тема Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions (and tablespace)
Дата
Msg-id 20190716050124.GG22387@telsasoft.com
обсуждение исходный текст
Ответ на Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions (and tablespace)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions  (Justin Pryzby <pryzby@telsasoft.com>)
Список pgsql-hackers
Sorry, I missed this until now.

On Sun, Jun 30, 2019 at 10:26:28AM +0200, Fabien COELHO wrote:
> *** About toast table v3:
> 
> Patch applies cleanly, compiles, works for me.
> 
> ISTM that the he query should be unambiguous: pg_catalog.pg_class instead of
> pg_class, add an alias (eg c), use c.FIELD to access an attribute. In its
> current form "pg_class" could resolve to another table depending on the
> search path.

Thanks for noticing, fixed.

> C style is broken. On "if () {", brace must be on next line. On "1 !=
> PQntuples(result)", I would exchange operands.
> 
> PQclear must be called on the main path.

Done

> There are no tests:-(

"show-childs" caused plenty of tests fail; actually..it looks like my previous
patch duplicated "tablespace" line for indices (and I managed to not notice the
original one, and claimed my patch fixed that omission, sigh).  I added test
that it shows its partitions, too.

It seems like an obviously good idea to add tests for \d toast; it's not clear
to me how to do run \d for a toast table, which is named after a user table's
OID...  (I tested that \gexec doesn't work for this).

So for now I used \d pg_toast.pg_toast_2619

> If the table name contains a ", the result looks awkward:
> 
>     For table: "public.foo"bla"
> 
> I'm wondering whether some escaping should be done. Well, it is not done for
> other simular entries, so probably this is bad but okay:-)

Leaving this for another commit-day.

Thanks for testing.

Justin

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: pgbench - add pseudo-random permutation function
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs