Re: PL/PgSQL "bare" function calls

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/PgSQL "bare" function calls
Date: 2004-09-15 15:19:41
Message-ID: 41485D8D.20401@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

>Neil Conway <neilc(at)samurai(dot)com> writes:
>
>
>>(3) The parser must distinguish between two cases when it sees an
>>unknown word (T_WORD) beginning a statement. The word could be the
>>beginning of a SQL statement (stmt_execsql in the grammar), such as:
>>
>>
>
>
>
>>UPDATE ...;
>>
>>
>
>
>
>>or the name of a function in a function call:
>>
>>
>
>
>
>>invoke_func(...);
>>
>>
>
>
>
>>The patch currently distinguishes between these cases by looking at the
>>next token -- if it is a left parenthesis, the patch assumes it is a
>>function call, otherwise it assumes it is a SQL statement. Is this the
>>best approach?
>>
>>
>
>That seems fairly unworkable. For example
>
> SELECT (2,3,4);
>
>is valid SQL. Also I'm not sure if you can extend this to cope with
>schema-qualified function names.
>
>
>
>

ISTM that this is being done at the wrong level anyway. I'd like to see
a facility available in our SQL, e.g.

CALL foo();

with the restriction that foo() should be declared to return void. Of
course, that doesn't remove the keyword requirement as Neil wanted, but
doing that would probably require a lot more work - we'd have to make
procedures a whole lot closer to first-class objects.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-09-15 15:21:28 Re: WIN1250 as server encoding
Previous Message Jeroen T. Vermeulen 2004-09-15 15:09:50 Re: WIN1250 as server encoding