SELECT EXTRACT doesn't work with variables? - Mailing list pgsql-general

From Conxita Marín
Subject SELECT EXTRACT doesn't work with variables?
Date
Msg-id 000001c2a695$8db0b020$0cd8a8c0@dims
Whole thread Raw
List pgsql-general
I try to do something like this:

CREATE FUNCTION prova() RETURNS numeric(20,0) AS
'
DECLARE
        aux TIMESTAMP;
        aux2 numeric(20,0);


BEGIN
        aux = ''01.01.2002 00:00:00 CET'';
        aux2 = SELECT EXTRACT(EPOCH FROM TIMESTAMP aux);
        RETURN aux2;
END;
' LANGUAGE 'plpgsql';

I obtain this error:

    NOTICE:  Error occurred while executing PL/pgSQL function prova
    NOTICE:  line 8 at assignment
    ERROR:  parser: parse error at or near "SELECT"

Is this a known bug?


pgsql-general by date:

Previous
From: SZUCS Gábor
Date:
Subject: Re: ORDER BY random() LIMIT 1 slowness
Next
From: Conxita Marín
Date:
Subject: SELECT EXTRACT doesn't work with variables?