Alvaro Herrera <alvherre@commandprompt.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