From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: turon.david@seznam.cz, pgsql-bugs@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: BUG #16743: psql doesn't show whole expression in stored column
Date: Tue, 24 Nov 2020 11:25:51 -0500
Message-ID: <287903.1606235151@sss.pgh.pa.us> (raw)
In-Reply-To: <20201124155106.GE29448@momjian.us>
References: <16743-7b1bacc4af76e7ad@postgresql.org>
<286182.1606232817@sss.pgh.pa.us>
<20201124155106.GE29448@momjian.us>
Bruce Momjian <bruce@momjian.us> writes:
> On Tue, Nov 24, 2020 at 10:46:57AM -0500, Tom Lane wrote:
>> 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.
It's less great in the context of a GENERATED column. As things stand,
the psql-side code wraps the truncated result into some more syntax:
else if (generated[0] == ATTRIBUTE_GENERATED_STORED)
default_str = psprintf("generated always as (%s) stored", PQgetvalue(res, i, attrdef_col));
else
/* (note: above we cut off the 'default' string at 128) */
default_str = PQgetvalue(res, i, attrdef_col);
which seems distinctly more confusing than just truncating the result.
So maybe there's justification here for revisiting that ancient decision.
One could also imagine not appending ") stored" if the attrdef value
appears to have been truncated --- although encoding-conversion effects
would make it hard to tell that for sure. Perhaps we'd be better off
to move the truncation logic to the psql side?
Another thing here, which is undeniably a bug, is that that psprintf
result is promptly leaked.
regards, tom lane
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: tgl@sss.pgh.pa.us, bruce@momjian.us, peter.eisentraut@enterprisedb.com
Subject: Re: BUG #16743: psql doesn't show whole expression in stored column
In-Reply-To: <287903.1606235151@sss.pgh.pa.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