Hi Surya.

Here is the v8-0001 patch.

This removes all the v7 behavioral changes I had made to \dn, and now
fixes only the original escape bug.

Note - It was necessary to change the SQL to use to_regnamespace() function.

Just doing:
...
"WHERE n.nspname = ");
appendStringLiteralConn(&buf, schemaname, pset.db);

does not work because \dn "HAS ' QUOTE" becomes '"HAS '' QUOTE"',
which solves the escape problem OK, but then the SQL won't find any
matching namespace with those double-quotes.

~~~

Meaniwhile, I did some more study about the behaviour changes that I
was previously attempting:

For "tables" there are options to use either \d or \dt

The \dt *always* give output as a LIST.
\dt         = LIST of everything
\dt pattern = LIST of tables matching a pattern
\dt name    = LIST of 1 table only

And, the \d can give additional object information in footers (e.g
what publication includes or excludes this table)

\d         = Lists everything also with footer information
\d pattern = Lists of tables matching the pattern but also with footer
information
\d name    = One table also with footer information

~

OTOH for "schemas" there is no choice which describe command you can
use. The \d does not work for schemas, and the \dn (schema equivalent
of \dt) always gives a LIST.

In v7, I was trying to give "\dn pattern" the ability to show footer
information, but as you correctly pointed out, that was breaking the
existing functionality of \dn for CSV lists.

I think I must abandon that idea because it seems \dn must either give
a LIST, or a list of objects with footers; it cannot try to
simulateously do both.

(The HEAD code does show footers for "\dn name" but because is using
string equality for the namespace name it can yeild only single
results, so the CSV is ok).

======
Kind Regards,
Peter Smith
Fujitsu Australia

Attachment: v8-0001-Fix-escapes-for-psql-describe-schema-patterns.patch
Description: Binary data

Reply via email to