Re: Inheritance and Constraints

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Andrew Vit <avit(at)telus(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Inheritance and Constraints
Date: 2003-07-20 06:39:22
Message-ID: 20030719233753.M55138-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Wed, 16 Jul 2003, Andrew Vit wrote:

> CREATE TABLE products (
> id serial NOT NULL PRIMARY KEY,
> name varchar(64) NOT NULL,
> );
>
> CREATE TABLE thing_1 (
> foo smallint,
> bar text,
> ) inherits (products);
>
> CREATE TABLE grading (
> thingid int NOT NULL REFERENCES thing_1 (id), --this is the problem.
> userid int NOT NULL REFERENCES users (id),
> vote smallint NOT NULL,
> PRIMARY KEY (thingid, userid)
> )

Is it complaining that there isn't a unique index on thing_1(id)? Primary
keys don't inherit currently, so there's no constraint guaranteeing
uniqueness on thing_1.id.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2003-07-20 07:33:14 Re: cidr & inet types
Previous Message Jason Godden 2003-07-20 05:34:26 Re: Horrible pg_restore performance, please help