Re: primary key error with PostgreSQL

[prev] [thread] [next] [Date index for 2005/05/22]

From: Cees Hek
Subject: Re: primary key error with PostgreSQL
Date: 00:13 on 22 May 2005
On 5/20/05, Sam Kelly <samuel.kelly@xxxxx.xxx> wrote:
> I dropped the table (no foreign keys) and recreated it with this:
>=20
> meal=3D> CREATE TABLE item (
> meal(>     itemid SERIAL PRIMARY KEY,
> meal(>     description TEXT,
> meal(>     qty INTEGER
> meal(> );
> NOTICE:  CREATE TABLE will create implicit sequence "item_itemid_seq"
> for "serial" column "item.itemid"
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> "item_pkey" for table "item"
> CREATE TABLE
> meal=3D> \q
>=20
> I still get the exact same error message :-(. I notice the SQL in the
> error message includes itemid in the field list for the INSERT. Does
> Class::DBI actually ask the database what the primary key is or does
> it just use the first element in the fields list? Either way it should
> work, right?

Are you telling Class::DBI about the new sequence?

__PACKAGE__->sequence('item_itemid_seq');

If you want this stuff to be configured automatically then you can use
the Class::DBI::Pg module to automatically configure the table for you
with the set_up_table method.

__PACKAGE__->set_up_table('item');

Cheers,

Cees

primary key error with PostgreSQL
cesmky 06:03 on 20 May 2005

Re: primary key error with PostgreSQL
Tony Bowden 06:25 on 20 May 2005

Re: primary key error with PostgreSQL
Brett Sanger 13:26 on 20 May 2005

Re: primary key error with PostgreSQL
Sam Kelly 02:49 on 21 May 2005

Re: primary key error with PostgreSQL
Cees Hek 00:13 on 22 May 2005

Re: primary key error with PostgreSQL
Sam Kelly 01:09 on 22 May 2005

Generated at 15:51 on 25 May 2005 by mariachi v0.52