Re: psql \df choose functions by their arguments - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: psql \df choose functions by their arguments
Date
Msg-id 20201029042645.GQ5380@telsasoft.com
Whole thread Raw
In response to psql \df choose functions by their arguments  (Greg Sabino Mullane <htamfids@gmail.com>)
Responses Re: psql \df choose functions by their arguments
Re: psql \df choose functions by their arguments
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: recovering from "found xmin ... from before relfrozenxid ..."
Next
From: vignesh C
Date:
Subject: Re: Log message for GSS connection is missing once connection authorization is successful.