From yulyanov@mera.ru Thu Sep 4 08:17:56 2003 X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0A9D9D1B9C0 for ; Thu, 4 Sep 2003 08:17:56 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 15212-01 for ; Thu, 4 Sep 2003 05:17:25 -0300 (ADT) Received: from mail.mera.ru (FireWall.mera.ru [195.98.50.58]) by svr1.postgresql.org (Postfix) with ESMTP id C29F7D1B98D for ; Thu, 4 Sep 2003 05:17:23 -0300 (ADT) Received: from drweb by mail.mera.ru with drweb-scanned (Exim 4.20) id 19upIy-000MuC-LG for pgsql-interfaces@postgresql.org; Thu, 04 Sep 2003 12:17:24 +0400 Received: from [192.168.12.128] (helo=ulyanov) by mail.mera.ru with smtp (Exim 4.20) id 19upIy-000Mu3-55 for pgsql-interfaces@postgresql.org; Thu, 04 Sep 2003 12:17:24 +0400 X-AntiVirus: Checked by Dr.Web (http://www.drweb.net) Message-ID: <013a01c372bd$5fee1610$800ca8c0@meraqms.ru> From: "Yaroslav Ulyanov" To: Subject: Create function problem Date: Thu, 4 Sep 2003 12:20:17 +0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0137_01C372DE.E6C719E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_50_60 X-Spam-Level: X-Archive-Number: 200309/1 X-Sequence-Number: 4419 This is a multi-part message in MIME format. ------=_NextPart_000_0137_01C372DE.E6C719E0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable Hello I cannot write new function with local variables: CREATE FUNCTION "get_new_id1" () RETURNS bigint AS' declare id bigint; begin id:=3Dnextval(\'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=20 ------=_NextPart_000_0137_01C372DE.E6C719E0 Content-Type: text/html; charset="koi8-r" Content-Transfer-Encoding: quoted-printable
Hello
 
I cannot write new function with local=20 variables:
 
 
CREATE FUNCTION "get_new_id1" () R= ETURNS=20 bigint AS'
 declare
   id=20 bigint;
 begin
  =20 id:=3Dnextval(\'id_sequence\'::text);
   return=20 id;
 end;
'LANGUAGE 'sql' VOLATILE ;
 
 
Error message see when=20 compiling:
 
ERROR:  parser= : parse=20 error at or near "bigint" at character 16
 
 
That I do=20 wrong?
 
 
Best regards,
Yaroslav Ulyanov
yulyanov@mera.ru
<= /HTML> ------=_NextPart_000_0137_01C372DE.E6C719E0-- From tgl@sss.pgh.pa.us Thu Sep 4 13:56:06 2003 X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 44F8CD1B9BC for ; Thu, 4 Sep 2003 13:56:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 38005-05 for ; Thu, 4 Sep 2003 10:55:59 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 416F2D1B56B for ; Thu, 4 Sep 2003 10:55:55 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h84DttjX021880; Thu, 4 Sep 2003 09:55:55 -0400 (EDT) To: "Yaroslav Ulyanov" Cc: pgsql-interfaces@postgresql.org Subject: Re: Create function problem In-reply-to: <013a01c372bd$5fee1610$800ca8c0@meraqms.ru> References: <013a01c372bd$5fee1610$800ca8c0@meraqms.ru> Comments: In-reply-to "Yaroslav Ulyanov" message dated "Thu, 04 Sep 2003 12:20:17 +0400" Date: Thu, 04 Sep 2003 09:55:54 -0400 Message-ID: <21879.1062683754@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/5 X-Sequence-Number: 4423 "Yaroslav Ulyanov" 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