Bug #650: using a trigger like a sequence doesn't work
От | pgsql-bugs@postgresql.org |
---|---|
Тема | Bug #650: using a trigger like a sequence doesn't work |
Дата | |
Msg-id | 20020426215802.712FF4758F0@postgresql.org обсуждение исходный текст |
Ответы |
mistakes in postgresql-snapshots (7.3)
|
Список | pgsql-bugs |
Wolfgang Messingschlager (w.mess@freenet.de) reports a bug with a severity of 2 The lower the number the more severe it is. Short Description using a trigger like a sequence doesn't work Long Description The purpose of my trigger is to build the same as a sequence, but it is not necessary to use every time nextval('<sequencename>') Sample Code > createlang plpgsql test > psql test Welcome to psql, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit test=# drop table person ; DROP test=# create table person (person_id integer PRIMARY KEY, test(# vorname VARCHAR(40), name VARCHAR(40) ); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'person_pkey' for table 'person' CREATE test=# drop table person_id ; DROP test=# create table person_id ( person_id integer); CREATE test=# insert into person_id values (0); INSERT 16701 1 test=# create or replace function before_insert_person_id () returns opaque test-# as 'Begin test'# update person_id set person_id = person_id + 1; test'# select into NEW.person_id person_id from person_id; test'# End;' test-# LANGUAGE 'plpgsql'; CREATE test=# create trigger person_id before insert on person for each row test-# EXECUTE PROCEDURE before_insert_person_id (); CREATE test=# insert into person (vorname, name) values ('John', 'Miller'); NOTICE: Error occurred while executing PL/pgSQL function before_insert_person_id NOTICE: at END of toplevel PL block ERROR: control reaches end of trigger procedure without RETURN test=# No file was uploaded with this report
В списке pgsql-bugs по дате отправления: