Re: psql \df choose functions by their arguments

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: psql \df choose functions by their arguments
Date: 2020-10-29 04:26:45
Message-ID: 20201029042645.GQ5380@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 15, 2020 at 01:21:06PM -0400, Greg Sabino Mullane wrote:
> Improve psql \df to choose functions by their arguments

I think this is a good idea.

This isn't working for arrays:

postgres=# \df aa
public | aa | integer | integer, integer | func
public | aa | integer | integer, integer, integer | func
public | aa | integer | integer[], integer, integer | func

postgres=# \df aa aa int[]

I think it should use the same syntax as \sf and \ef, which require parenthesis
and commas, not spaces.

int x = 0
while ((functoken = strtokx(x++ ? NULL : funcargs, " \t\n\r", ".,();", "\"", 0, false, true, pset.encoding)))

I think x is just used as "initial", so I think you should make it boolean and
then set is_initial = false, or similar.

+ pg_strcasecmp(functoken, "bool") == 0 ? "'boolean'"

I think writing this all within a call to appendPQExpBuffer() is excessive.
You can make an array or structure to search through and then append the result
to the buffer.

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2020-10-29 04:34:56 Re: Log message for GSS connection is missing once connection authorization is successful.
Previous Message Noah Misch 2020-10-29 04:01:59 Re: Spurious "apparent wraparound" via SimpleLruTruncate() rounding