Received: from cortex.unice.fr (root@cortex.unice.fr [134.59.53.1]) by hub.org (8.8.8/8.7.5) with ESMTP id KAA25939 for ; Wed, 27 May 1998 10:26:10 -0400 (EDT) Received: from unice.fr (cortex.unice.fr [134.59.53.1]) by cortex.unice.fr (8.8.5/8.8.5) with ESMTP id QAA22837 for ; Wed, 27 May 1998 16:22:31 +0200 Sender: jerome@cortex.unice.fr Message-ID: <356C21A7.7A56B514@unice.fr> Date: Wed, 27 May 1998 14:22:31 +0000 From: Jerome ALET Reply-To: alet@unice.fr Organization: Faculte de Medecine de Nice X-Mailer: Mozilla 4.04 [en] (X11; I; Linux 2.0.33 sparc) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: nextval Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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