pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Create function problem
2+ messages / 2 participants
[nested] [flat]

* Create function problem
@ 2003-09-04 08:20 Yaroslav Ulyanov <yulyanov@mera.ru>
  2003-09-04 13:55 ` Re: Create function problem Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Yaroslav Ulyanov @ 2003-09-04 08:20 UTC (permalink / raw)
  To: pgsql-interfaces

Hello

I cannot write new function with local variables:


CREATE FUNCTION "get_new_id1" () RETURNS bigint AS'
 declare
   id bigint;
 begin
   id:=nextval(\'id_sequence\'::text);
   return id;
 end;
'LANGUAGE 'sql' VOLATILE ;


Error message see when compiling:

ERROR:  parser: parse error at or near "bigint" at character 16


That I do wrong?


Best regards,
Yaroslav Ulyanov
yulyanov@mera.ru 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Create function problem
  2003-09-04 08:20 Create function problem Yaroslav Ulyanov <yulyanov@mera.ru>
@ 2003-09-04 13:55 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2003-09-04 13:55 UTC (permalink / raw)
  To: Yaroslav Ulyanov <yulyanov@mera.ru>; +Cc: pgsql-interfaces

"Yaroslav Ulyanov" <yulyanov@mera.ru> writes:

> CREATE FUNCTION "get_new_id1" () RETURNS bigint AS'
>  declare
>    id bigint;
>  begin
>    id:=3Dnextval(\'id_sequence\'::text);
>    return id;
>  end;
> 'LANGUAGE 'sql' VOLATILE ;

That's plpgsql code, but you've declared the function as language 'sql'.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-09-04 13:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04 08:20 Create function problem Yaroslav Ulyanov <yulyanov@mera.ru>
2003-09-04 13:55 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox