Re: psql \df choose functions by their arguments

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: Ian Lawrence Barwick <barwick@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-04-08T02:00:08Z
Lists: pgsql-hackers

Attachments

I wrote:
> I had an idea about that.  I've not tested this, but I think it would be
> a trivial matter of adding a coalesce() call to make the query act like
> the type name for a not-present argument is an empty string, rather than
> NULL which is what it gets right now.  Then you could do what I think
> you're asking for with

> \df foo integer ""

Actually, what would make more sense is to treat "-" as specifying
a non-existent argument.  There are precedents for that in, eg, \c,
and a dash is a little more robust than an empty-string argument.
So that leads me to 0001 attached.

> As for the point about "int" versus "integer" and so on, I wouldn't
> be averse to installing a mapping layer for that, so long as we
> did it to \dT as well.

And for that, I suggest 0002.  (We only need mappings for cases that
don't work out-of-the-box, so your list seemed a bit redundant.)

			regards, tom lane

Commits

  1. Allow psql's \df and \do commands to specify argument types.