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