Fix format_type() to restore its old behavior.

Commit a26116c6c accidentally changed the behavior of the SQL format_type()
function while refactoring.  For the reasons explained in that function's
comment, a NULL typemod argument should behave differently from a -1
argument.  Since we've managed to break this, add a regression test
memorializing the intended behavior.

In passing, be consistent about the type of the "flags" parameter.

Noted by Rushabh Lathia, though I revised the patch some more.

Discussion: 
https://postgr.es/m/cagpqqf3rb2q-d2awp_-x-ur6aoxtuwnapt-vm-ittcezxyn...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8f72a5704854d292065886eb47ba18fbd504113e

Modified Files
--------------
contrib/postgres_fdw/deparse.c            |  2 +-
src/backend/utils/adt/format_type.c       | 30 +++++++++++++++++++-----------
src/test/regress/expected/create_type.out | 20 ++++++++++++++++++++
src/test/regress/sql/create_type.sql      |  6 ++++++
4 files changed, 46 insertions(+), 12 deletions(-)

Reply via email to