From: | "Jeff Eckermann" <jeckermann(at)verio(dot)net> |
---|---|
To: | "Ron S" <zhi7c001(at)sneakemail(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Newbie ...Function error (Stored Procedure)? |
Date: | 2001-08-31 21:32:29 |
Message-ID: | 053c01c13264$702cd7f0$279c10ac@INTERNAL |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I think you need to double the single quotes around the sequence name:
(''seq1'').
Statements inside function definitions go through an extra level of parsing,
which strips off one set of single quotes.
----- Original Message -----
From: "Ron S" <zhi7c001(at)sneakemail(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, August 27, 2001 2:34 PM
Subject: [GENERAL] Newbie ...Function error (Stored Procedure)?
> I have a sequence called seq1.
>
> In psql I am trying to create a function which simply calls this
> sequence with the nextval() function.
>
> CREATE FUNCTION testid()
> RETURNS INTEGER
> AS 'SELECT NEXTVAL('seq1');'
> LANGUAGE 'SQL';
>
>
> I get the following error....
> ERROR: parser: parser error at or near "seq1"
>
> I can call nextval('seq1') by itself with now error.
>
> What am I doing wrong? I can't for the life of me figure this
> seemingly simple
> error out ;)
>
> Postgresql 7.0.3 on Mandrake 8.0
>
> Thanks,
> Ron
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Eckermann | 2001-08-31 21:37:34 | Re: Is it possible to default all number data to numeric type? |
Previous Message | james | 2001-08-31 21:19:30 | Re: PostgreSQL On the Mac? OS9 or OSX? |