nextval - Mailing list pgsql-sql

From Jerome ALET
Subject nextval
Date
Msg-id 356C21A7.7A56B514@unice.fr
Whole thread Raw
Responses Re: [SQL] nextval  (Patrice Hédé <patrice@idf.net>)
List 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

pgsql-sql by date:

Previous
From: "Basma, Stein-Aksel"
Date:
Subject: subscribe
Next
From: Dirk Lutzebaeck
Date:
Subject: SELECT across two databases