]> git.ipfire.org Git - thirdparty/postgresql.git/commit
In psql's \d commands, don't truncate attribute default values.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Nov 2020 21:19:25 +0000 (16:19 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 25 Nov 2020 21:19:25 +0000 (16:19 -0500)
commitea7a167daa3e7c9c7b03fb09432aafcea1cf4d88
treee96e1fbbf1380c3185b6cb00394191c52af2c85a
parentb608645c17d7979357ebdbc9f461bfca54a6a415
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
src/bin/psql/describe.c