From: Bernd Hoffmann <info@unixserver.info>
To: pgsql-php@postgresql.org
Subject: functions with plpgsql
Date: Sat, 9 Aug 2003 22:18:38 +0200
Message-ID: <01b101c35eb3$6e75b2b0$3214a8c0@server> (raw)
Hi,
I have some problems by using functions with plpgsql.
For example:
tbl:
CREATE TABLE "logs" (
"id" int4 DEFAULT nextval('"logs_id_seq"'::text) NOT NULL,
"session" varchar NOT NULL,
"addr" inet NOT NULL,
"host" varchar NOT NULL,
"agent" varchar NOT NULL,
"datum" timestamptz DEFAULT now(),
"referer" varchar,
CONSTRAINT "logs_pkey" PRIMARY KEY ("id")
);
function:
CREATE FUNCTION "next_id"(character varying) RETURNS integer AS '
DECLARE
tabelle ALIAS FOR $1;
BEGIN
SELECT MAX(id)+1 FROM tabelle;
END;
' LANGUAGE 'plpgsql'
query:
SELECT next_id(logs);
error:
PostgreSQL meldet: ERROR: parser: parse error at or near "$1"
Can anybody help me?
MfG
Bernd Hoffmann
unixserver.info
96123 Litzendorf
Tel: +499505/8050485
Fax: +499505/8050486
info@unixserver.info
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: info@unixserver.info
Subject: Re: functions with plpgsql
In-Reply-To: <01b101c35eb3$6e75b2b0$3214a8c0@server>
References: <01b101c35eb3$6e75b2b0$3214a8c0@server>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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