nextval

From: Jerome ALET <alet(at)unice(dot)fr>
To: pgsql-sql(at)postgresql(dot)org
Subject: nextval
Date: 1998-05-27 14:22:31
Message-ID: 356C21A7.7A56B514@unice.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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(at)unice(dot)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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dirk Lutzebaeck 1998-05-27 14:35:14 SELECT across two databases
Previous Message Basma, Stein-Aksel 1998-05-27 12:13:26 subscribe