pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to \ef a function ?
4+ messages / 3 participants
[nested] [flat]

* How to \ef a function ?
@ 2024-01-08 16:26  David Gauthier <dfgpostgres@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: David Gauthier @ 2024-01-08 16:26 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

atletx7-reg017:/home/dgauthie[ 120 ] --> dvdbdev
Pager usage is off.
psql (11.5, server 11.3)
Type "help" for help.

dvdb=# \df opid.bef_ins_axi_reqs_set_trig;
                                 List of functions
 Schema |           Name            | Result data type | Argument data
types | Type
--------+---------------------------+------------------+---------------------+------
 opid   | bef_ins_axi_reqs_set_trig | trigger          |
  | func
(1 row)

dvdb=# \ef opid.bef_ins_axi_reqs_set_trig;
ERROR:  function "opid.bef_ins_axi_reqs_set_trig;" does not exist
dvdb=# \ef opid.bef_ins_axi_reqs_set_trig();
ERROR:  expected a right parenthesis
dvdb=#

So the function exists with \df but not \ef ?
I get the need to identify the argument list (in case there's >1 with same
name, diff arg list), but '()' doesn't work.  Does this have to do with the
returned trigger type ?

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to \ef a function ?
@ 2024-01-08 16:40  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: David Gauthier <dfgpostgres@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Adrian Klaver @ 2024-01-08 16:40 UTC (permalink / raw)
  To: David Gauthier <dfgpostgres@gmail.com>; pgsql-general@lists.postgresql.org

On 1/8/24 08:26, David Gauthier wrote:
> atletx7-reg017:/home/dgauthie[ 120 ] --> dvdbdev
> Pager usage is off.
> psql (11.5, server 11.3)
> Type "help" for help.
> 
> dvdb=# \df opid.bef_ins_axi_reqs_set_trig;
>                                   List of functions
>   Schema |           Name            | Result data type | Argument data 
> types | Type
> --------+---------------------------+------------------+---------------------+------
>   opid   | bef_ins_axi_reqs_set_trig | trigger          |               
>        | func
> (1 row)
> 
> dvdb=# \ef opid.bef_ins_axi_reqs_set_trig;
> ERROR:  function "opid.bef_ins_axi_reqs_set_trig;" does not exist

Lose the ';'.

It should be:

\ef opid.bef_ins_axi_reqs_set_trig

> dvdb=# \ef opid.bef_ins_axi_reqs_set_trig();
> ERROR:  expected a right parenthesis
> dvdb=#
> 
> So the function exists with \df but not \ef ?
> I get the need to identify the argument list (in case there's >1 with 
> same name, diff arg list), but '()' doesn't work.  Does this have to do 
> with the returned trigger type ?
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to \ef a function ?
@ 2024-01-08 16:47  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2024-01-08 16:47 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: David Gauthier <dfgpostgres@gmail.com>; pgsql-general@lists.postgresql.org

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 1/8/24 08:26, David Gauthier wrote:
>> dvdb=# \ef opid.bef_ins_axi_reqs_set_trig;
>> ERROR:  function "opid.bef_ins_axi_reqs_set_trig;" does not exist

> Lose the ';'.
> It should be:
> \ef opid.bef_ins_axi_reqs_set_trig

Yeah, that's what psql is expecting, but it does seem a bit
unforgiving considering that you can write a noise semicolon
in many other backslash commands.  And this:

>> dvdb=# \ef opid.bef_ins_axi_reqs_set_trig();
>> ERROR:  expected a right parenthesis

seems outright buggy.  I've not looked at the code though.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: How to \ef a function ?
@ 2024-01-08 17:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2024-01-08 17:12 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: David Gauthier <dfgpostgres@gmail.com>; pgsql-general@lists.postgresql.org

I wrote:
> Yeah, that's what psql is expecting, but it does seem a bit
> unforgiving considering that you can write a noise semicolon
> in many other backslash commands.  And this:

> dvdb=# \ef opid.bef_ins_axi_reqs_set_trig();
> ERROR:  expected a right parenthesis

> seems outright buggy.  I've not looked at the code though.

Ah, I see it.  The difference in the error messages is because \ef
feeds the whole argument to regprocin to find out the function OID
if there are no parens, but regprocedurein if there are parens.
Neither of those functions like the trailing semicolon, but their
complaints are different.

More interestingly, \ef is actually trying to ignore trailing
semicolons: exec_command_ef_ev tells psql_scan_slash_option
to do so.  But it's using OT_WHOLE_LINE mode and that function
ignores the request in that mode.  So that seems like an
oversight.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2024-01-08 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 16:26 How to \ef a function ? David Gauthier <dfgpostgres@gmail.com>
2024-01-08 16:40 ` Adrian Klaver <adrian.klaver@aklaver.com>
2024-01-08 16:47   ` Tom Lane <tgl@sss.pgh.pa.us>
2024-01-08 17:12     ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox