From: Jerome ALET <alet@unice.fr>
To: pgsql-sql@postgresql.org
Subject: nextval
Date: Wed, 27 May 1998 14:22:31 +0000
Message-ID: <356C21A7.7A56B514@unice.fr> (raw)
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
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: alet@unice.fr
Subject: Re: nextval
In-Reply-To: <356C21A7.7A56B514@unice.fr>
* 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