> and why not something like:
>
> CREATE FUNCTION first_word ( :x CHAR VARYING(1000) )
>    RETURNS CHAR VARYING(40)
>    LANGUAGE SQL
>    RETURN TRIM (SUBSTRING ((:X || ' ') FROM 1 FOR POSITION (' ' IN (:X || '')
> )));
>
> as described in SQL/PSM (SQL Persistent Stored Modules) (see "A Guide To The
> SQL Standard" apendix E)
> instead of re-invent the wheel. ;)

Because the SQL parser has to parse the stored procedure to find the end. In
postgres you can have embedded tcl and any arbitrary language, so it is quite
difficult to handle that properly.

jochen

Mon, 30 Aug 1999 22:54:30 +0200
pgsql-hackers@mail.remote.org
Re: [HACKERS] Quoting in stored procedures