From: | "Bernd Hoffmann" <info(at)unixserver(dot)info> |
---|---|
To: | <pgsql-php(at)postgresql(dot)org> |
Subject: | functions with plpgsql |
Date: | 2003-08-09 20:18:38 |
Message-ID: | 01b101c35eb3$6e75b2b0$3214a8c0@server |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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(at)unixserver(dot)info
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew J. Kopciuch | 2003-08-10 00:04:10 | Re: functions with plpgsql |
Previous Message | David Busby | 2003-08-08 21:59:07 | Re: Paging results |