From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: turon.david@seznam.cz
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16743: psql doesn't show whole expression in stored column
Date: Tue, 24 Nov 2020 10:51:06 -0500
Message-ID: <20201124155106.GE29448@momjian.us> (raw)
In-Reply-To: <286182.1606232817@sss.pgh.pa.us>
References: <16743-7b1bacc4af76e7ad@postgresql.org>
<286182.1606232817@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, turon.david@seznam.cz, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16743: psql doesn't show whole expression in stored column
In-Reply-To: <20201124155106.GE29448@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox