From: | missive(at)frontiernet(dot)net (Lee Harr) |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Problems w. SERIAL |
Date: | 2001-05-06 00:38:49 |
Message-ID: | 9d26ep$l1c$1@node17.cwnet.roc.gblx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, 05 May 2001 19:34:06 +0200, Morten Primdahl <morten(at)primdahl(dot)net> wrote:
>Hi.
>
>Have the following tables:
>
>CREATE TABLE tbl_a (id SERIAL PRIMARY KEY, data VARCHAR(5));
>CREATE TABLE tbl_b (id SERIAL PRIMARY KEY, data VARCHAR(5));
>
>CREATE TABLE tbl_c
> (id SERIAL PRIMARY KEY,
> data VARCHAR(50),
> a SERIAL CONSTRAINT a_ref REFERENCES tbl_a(id),
> b SERIAL CONSTRAINT b_ref REFERENCES tbl_b(id)
>);
>
>The two inserts into tbl_a and tbl_b work fine:
>
>INSERT INTO tbl_a (data) VALUES ('a data');
>INSERT INTO tbl_b (data) VALUES ('b data');
>
>But if I do
>
>INSERT INTO tbl_c (data, a, b) VALUES ('c data',1,1);
>
>I get ERROR: Relation 'tbl_c_id_seq' does not exist
>even though that sequence was implicitly created upon
>creation of tbl_c - or?
>
>Can anyone help me out on this? Thanks.
>
>Morten
Can you do
SELECT nextval( 'tbl_c_id_seq' );
in psql successfully?
if not, is the sequence actually there? try
\d
or
\d tbl_c_id_seq
if it is not there, you can create it yourself
CREATE SEQUENCE tbl_c_id_seq;
if it is there... not sure what to say.
From | Date | Subject | |
---|---|---|---|
Next Message | Morten Primdahl | 2001-05-06 00:59:31 | Re: Problems w. SERIAL |
Previous Message | Dave Cramer | 2001-05-06 00:05:56 | Re: Accounting Schema |