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

From Fabien COELHO
Subject Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions (and tablespace)
Date
Msg-id alpine.DEB.2.21.1906300955550.23641@lancre
Whole thread Raw
In response to 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 <pryzby@telsasoft.com>)
Responses Re: make \d pg_toast.foo show its indices ; and, \d toast show itsmain table ; and \d relkind=I show its partitions (and tablespace)
List pgsql-hackers
There are 3 independent patches associated to one thread and one CF entry.


*** 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.

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.

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:-)

There are no tests:-(


*** About toast index v3

Patch applies cleanly, compiles, works for me.

There are no tests:-(

*** About the next one, v4

Patch applies cleanly, compiles. Not sure how to test it.

"switch (*PQgetvalue(result, i, 2))": I understand that relkind is a must 
admit I do not like this style much, an intermediate variable would 
improve readability. Also, a simple if instead of a swich might be more 
appropriate, and be closer to the previous implementation.

There are no tests:-(

-- 
Fabien.



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Multivariate MCV list vs. statistics target
Next
From: Pavel Stehule
Date:
Subject: Re: proposal - patch: psql - sort_by_size