On Tue, Nov 24, 2020 at 10:46:57AM -0500, Tom Lane wrote:
> PG Bug reporting form <noreply@postgresql.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@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee