nextval
Jerome Alet <alet@unice.fr>
From: Jerome ALET <alet@unice.fr>
To: pgsql-sql@postgresql.org
Date: 1998-05-27T14:22:31Z
Lists: pgsql-sql
Hello all, I've read the different solutions about nextval in the digest but haven't tried any for now. Could someone explain me why the following doesn't work: CREATE TABLE slogans (numero_slogan INT4 PRIMARY KEY NOT NULL, date_slogan DATE NOT NULL, points_slogans INT4); NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index slogans_pkey for table slogans CREATE CREATE SEQUENCE seq_slogans INCREMENT 1 MINVALUE 1 START 1; CREATE CREATE RULE rule_i_slogans AS ON INSERT TO slogans DO UPDATE NEW SET numero_slogan = nextval(seq_slogans) , points_slogan = 10; ERROR: attribute 'seq_slogans' not found if I replace the "nextval(seq_slogans)" with a constant in the rule it works. I thought it was an elegant solution. If someone has got an idea .... Thanks. Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE