I wonder if I'm not facing to a bug in PostgreSQL.
I defined for convenience a LEFT function like this :
----------------------------------------------------------------------------
----------------------------
CREATE OR REPLACE FUNCTION LEFT( text, int) RETURNS text AS '
DECLARE
_STRori ALIAS FOR $1;
_INTlength ALIAS FOR $2;
BEGIN
RETURN SUBSTRING( _STRori, 1, _INTlength );
END'
LANGUAGE 'plpgsql';
----------------------------------------------------------------------------
----------------------------
Then I want to use this function in SQL statements.
SELECT LEFT( 'String1', 3 ) -> Str
SELECT LEFT( 'String1', 3 ) || 'End' -> StrEnd
SELECT 'Begin' || SUBSTRING( 'String1', 1, 3 ) -> BeginStr
BUT
SELECT 'Begin' || LEFT( 'String1', 3 ) -> ERROR: parser: parse error at or
near "LEFT"
Perhaps I misunderstood something but it seems there is a problem in
PostgreSQL parser.
My version is : PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.96.
Patrick Fiche
email : patrick.fiche@aqsacom.com
tél : 01 69 29 36 18