Re: BUG #16743: psql doesn't show whole expression in stored column

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: turon(dot)david(at)seznam(dot)cz, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16743: psql doesn't show whole expression in stored column
Date: 2020-11-24 15:51:06
Message-ID: 20201124155106.GE29448@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Nov 24, 2020 at 10:46:57AM -0500, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > when generated column expression length is larger then some value - the rest
> > of expression is cut in \d[+] output:
>
> Yeah, this is an intentional and very ancient behavior:
>
> appendPQExpBufferStr(&buf,
> ",\n (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid, true) for 128)"
> "\n FROM pg_catalog.pg_attrdef d"
>
> Maybe we should decide that completeness is more important than keeping
> the line to some arbitrary width. But it's operating as designed.

I think I am fine with the current behavior.

If you run psql with -E, you can see the queries it generates:

SELECT a.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod),
--> (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid, true) for 128)
--------- -------
FROM pg_catalog.pg_attrdef d
WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),
a.attnotnull,
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation,
a.attidentity,
a.attgenerated
FROM pg_catalog.pg_attribute a
WHERE a.attrelid = '16385' AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum;

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EnterpriseDB https://enterprisedb.com

The usefulness of a cup is in its emptiness, Bruce Lee

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2020-11-24 16:25:51 Re: BUG #16743: psql doesn't show whole expression in stored column
Previous Message Manoj Kumar 2020-11-24 15:47:38 Re: BUG #16739: Temporary files not deleting from data folder on disk