format_type infelicity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: format_type infelicity
Date: 2001-11-19 04:37:11
Message-ID: 10942.1006144631@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just noticed that psql is now printing function argument/result types
in a less than pleasing fashion:

regression=# \df length
List of functions
Result data type | Name | Argument data types
------------------+--------+---------------------
integer | length | "bit"
integer | length | bpchar
integer | length | character varying
integer | length | text
....

It used to show these first two as unquoted bit and character,
respectively. The reason for the change is my recent twiddling
to ensure that pg_dump would dump the types of columns with -1
typmod in an appropriate fashion.

I think an appropriate fix would be to make the format_type function
distinguish between format_type(typeoid, -1) and format_type(typeoid,
NULL), which it currently treats the same. The former could be taken
to mean "give me the type name for a column with typmod -1" whereas
the latter could be taken to mean "give me a type name in a context
where there is no typmod", such as a function argument/result type.

Looking through the existing uses of format_type, it seems that all
the call sites have the right choice already, so this behavior is not
too unreasonable. Any objections?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-11-19 06:48:43 Re: OCTET_LENGTH is wrong
Previous Message Marc G. Fournier 2001-11-19 03:42:43 Re: beta3