Re: Can the string literal syntax for function definitions please be dropped ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Timothy Madden <terminatorul(at)gmail(dot)com>, Adrian Klaver <aklaver(at)comcast(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Can the string literal syntax for function definitions please be dropped ?
Date: 2009-10-26 00:17:22
Message-ID: 23844.1256516242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> SQL/PSM is a different beast than all the rest of the PLs, because it is
> standard, so I am sure that we will want to implement the standard
> syntax (no string literal) when we have SQL/PSM. But implementing no-
> string-literals before we get full SQL/PSM support would be pointless,
> because there are so many other things that are not standard in that
> area. Simply removing the quotes (which is what you are requesting)
> would not take our standards compliance much further.

[ after re-reading the spec a little bit ... ]

One interesting point here is that I don't think the spec suggests
that SQL/PSM can be written in-line in the CREATE FUNCTION statement
at all. What I see (at least in SQL99) is

<schema function> ::=
CREATE <SQL-invoked function>

<SQL-invoked function> ::=
{ <function specification> | <method specification designator> }

<routine body>

<function specification> ::=
FUNCTION <schema qualified routine name>
<SQL parameter declaration list>
<returns clause>
<routine characteristics>
[ <dispatch clause> ]

<routine body> ::=
<SQL routine body>
| <external body reference>

<SQL routine body> ::= <SQL procedure statement>

and <SQL procedure statement> seems to allow one (count em, one) SQL DDL
or DML statement. So per spec, essentially every interesting case
requires an <external body reference>. We could possibly support the
single-SQL-statement case without any quotes --- at least, it doesn't
obviously break clients to do that; handling it inside the backend still
seems nontrivial. But it's not clear to me that that case is useful
enough to be worth the trouble.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David W Noon 2009-10-26 00:43:39 Re: Can the string literal syntax for function definitions please be dropped ?
Previous Message Alvaro Herrera 2009-10-25 23:56:00 Re: Can the string literal syntax for function definitions please be dropped ?