pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: In psql's \d commands, don't truncate attribute default values.
3+ messages / 1 participants
[nested] [flat]

* pgsql: In psql's \d commands, don't truncate attribute default values.
@ 2020-11-25 21:19  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-11-25 21:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql's \d commands, don't truncate attribute default values.

Historically, psql has truncated the text of a column's default
expression at 128 characters.  This is unlike any other behavior
in describe.c, and it's become particularly confusing now that
the limit is only applied to the expression proper and not to
the "generated always as (...) stored" text that may get wrapped
around it.

Excavation in our git history suggests that the original motivation
for this limit was not really to limit the display width (as I'd long
supposed), but to make it safe to use a fixed-width output buffer to
store the result.  That implementation restriction is long gone of
course, but the limit remained.  Let's just get rid of it.

While here, rearrange the logic about when to free the output string
so that it's not so dependent on unstated assumptions about the
possible values of attidentity and attgenerated.

Per bug #16743 from David Turon.  Back-patch to v12 where GENERATED
came in.  (Arguably we could take it back further, but I'm hesitant
to change the behavior of long-stable branches for this.)

Discussion: https://postgr.es/m/16743-7b1bacc4af76e7ad@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/314fb9baeacb3426a5d9a26132aae8d828cc0ad7

Modified Files
--------------
src/bin/psql/describe.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: In psql's \d commands, don't truncate attribute default values.
@ 2020-11-25 21:19  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-11-25 21:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql's \d commands, don't truncate attribute default values.

Historically, psql has truncated the text of a column's default
expression at 128 characters.  This is unlike any other behavior
in describe.c, and it's become particularly confusing now that
the limit is only applied to the expression proper and not to
the "generated always as (...) stored" text that may get wrapped
around it.

Excavation in our git history suggests that the original motivation
for this limit was not really to limit the display width (as I'd long
supposed), but to make it safe to use a fixed-width output buffer to
store the result.  That implementation restriction is long gone of
course, but the limit remained.  Let's just get rid of it.

While here, rearrange the logic about when to free the output string
so that it's not so dependent on unstated assumptions about the
possible values of attidentity and attgenerated.

Per bug #16743 from David Turon.  Back-patch to v12 where GENERATED
came in.  (Arguably we could take it back further, but I'm hesitant
to change the behavior of long-stable branches for this.)

Discussion: https://postgr.es/m/16743-7b1bacc4af76e7ad@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ea7a167daa3e7c9c7b03fb09432aafcea1cf4d88

Modified Files
--------------
src/bin/psql/describe.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: In psql's \d commands, don't truncate attribute default values.
@ 2020-11-25 21:19  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2020-11-25 21:19 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

In psql's \d commands, don't truncate attribute default values.

Historically, psql has truncated the text of a column's default
expression at 128 characters.  This is unlike any other behavior
in describe.c, and it's become particularly confusing now that
the limit is only applied to the expression proper and not to
the "generated always as (...) stored" text that may get wrapped
around it.

Excavation in our git history suggests that the original motivation
for this limit was not really to limit the display width (as I'd long
supposed), but to make it safe to use a fixed-width output buffer to
store the result.  That implementation restriction is long gone of
course, but the limit remained.  Let's just get rid of it.

While here, rearrange the logic about when to free the output string
so that it's not so dependent on unstated assumptions about the
possible values of attidentity and attgenerated.

Per bug #16743 from David Turon.  Back-patch to v12 where GENERATED
came in.  (Arguably we could take it back further, but I'm hesitant
to change the behavior of long-stable branches for this.)

Discussion: https://postgr.es/m/16743-7b1bacc4af76e7ad@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a0ef0817204dbbcb326b14071e827bf181cfa2cb

Modified Files
--------------
src/bin/psql/describe.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2020-11-25 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 21:19 pgsql: In psql's \d commands, don't truncate attribute default values. Tom Lane <tgl@sss.pgh.pa.us>
2020-11-25 21:19 pgsql: In psql's \d commands, don't truncate attribute default values. Tom Lane <tgl@sss.pgh.pa.us>
2020-11-25 21:19 pgsql: In psql's \d commands, don't truncate attribute default values. Tom Lane <tgl@sss.pgh.pa.us>

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