pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
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: Wed, 25 Nov 2020 10:03:53 -0500
Message-ID: <426714.1606316633@sss.pgh.pa.us> (raw)
In-Reply-To: <7a1faa2c-d4d1-67fd-03fe-29ef7e240301@enterprisedb.com>
References: <16743-7b1bacc4af76e7ad@postgresql.org>
	<286182.1606232817@sss.pgh.pa.us>
	<7a1faa2c-d4d1-67fd-03fe-29ef7e240301@enterprisedb.com>

Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> On 2020-11-24 16:46, 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 we should get rid of the truncating.  Otherwise, there is no way 
> to actually get the full information, is there?  (Other than pg_dump or 
> manual catalog queries.)

That'd be okay with me.  It's always seemed a little odd that we do that
for attrdefs but not anything else.

A bit of checking with git blame says that the habit came in with
the very first version of describe.c, in

    commit a45195a191eec367a4f305bb71ab541d17a3b9f9
    Author: Bruce Momjian <bruce@momjian.us>
    Date:   Thu Nov 4 21:56:02 1999 +0000

        Major psql overhaul by Peter Eisentraut.

which has

+    /* Info */
+    cells[i*cols + 2] = xmalloc(128 + 128); /* I'm cutting off the default string at 128 */
+    cells[i*cols + 2][0] = '\0';
+    if (strcmp(PQgetvalue(res, i, 4), "t") == 0)
+        strcat(cells[i*cols + 2], "not null");
+    if (strcmp(PQgetvalue(res, i, 5), "t") == 0) {
+        /* handle "default" here */
+        strcpy(descbuf, "SELECT substring(d.adsrc for 128) FROM pg_attrdef d, pg_class c\n"
+                    "WHERE c.relname = '");

So that looks very much like the truncation was an expedient thing
to do to work with a fixed-size result buffer, rather than something
that was chosen to improve the user experience.

			regards, tom lane





view thread (11+ messages)  latest in thread

Message-ID: <426714.1606316633@sss.pgh.pa.us>
Permalink:  ../426714.1606316633@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/426714.1606316633@sss.pgh.pa.us

 · 

reply

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, peter.eisentraut@enterprisedb.com, 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: <426714.1606316633@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