From: Graf László <graf.laszlo@axis.hu>
To: pgsql-sql@postgresql.org
To: peter_e@gmx.net
Subject: ERROR: syntax error at or near "select" at character 9
Date: Fri, 02 Sep 2005 09:26:04 +0200
Message-ID: <4317FE8C.7020803@axis.hu> (raw)
Hi
I am using PG 8.0 on Win32, learning SQL.
I dod create a table with the following SQL:
CREATE TABLE test (
id integer,
nev varchar(25),
datum timestamp
);
A sequence with:
CREATE SEQUENCE "public"."test_azon_seq"
INCREMENT 1 MINVALUE 101
MAXVALUE 9223372036854775807 START 101
CACHE 1
;
A before insert trigger:
CREATE FUNCTION test_verif() RETURNS trigger AS $test_verif$
BEGIN
NEW.id := select nextval('test_azon_seq');
NEW.nev := nev;
NEW.datum := current_timestamp;
RETURN NEW;
END;
$test_verif$ LANGUAGE plpgsql
;
CREATE TRIGGER test_verif BEFORE INSERT ON test
FOR EACH ROW EXECUTE PROCEDURE test_verif()
;
When I issue the
insert into "public"."test" (nev) values ('Graf László');
insert statement, it returns
"ERROR: syntax error at or near "select" at character 9".
Why? What is wrong?
--
László Graf
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: graf.laszlo@axis.hu, peter_e@gmx.net
Subject: Re: ERROR: syntax error at or near "select" at character 9
In-Reply-To: <4317FE8C.7020803@axis.hu>
* 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