Re: Inherited FK Indexing

From: Erik Jones <erik(at)myemma(dot)com>
To: Ketema Harris <ketema(at)ketema(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Inherited FK Indexing
Date: 2007-09-14 16:23:14
Message-ID: 1CC81F59-29E8-4D56-AEEE-D1B85AA29886@myemma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sep 14, 2007, at 10:35 AM, Ketema Harris wrote:

> I have the following table set up:
>
> CREATE TABLE states
> (
> state_id integer NOT NULL DEFAULT nextval
> ('state_province_id_seq'::regclass),
> state character(2),
> full_name character varying,
> timezone character varying,
> CONSTRAINT "PK_state_id" PRIMARY KEY (state_id)
> )
>
> CREATE TABLE canadian_provinces
> (
> -- Inherited: state_id integer NOT NULL DEFAULT nextval
> ('state_province_id_seq'::regclass),
> -- Inherited: state character(2),
> -- Inherited: full_name character varying,
> -- Inherited: timezone character varying,
> CONSTRAINT "PK_province_id" PRIMARY KEY (state_id)
> )
>
> as expected I can do select * from states and get everything out of
> the child table as well. What I can't do is create a FK to the
> states table and have it look in the child table as well. Is this
> on purpose? Is it possible to have FK that spans into child tables?

I'm assuming you just left out an INHERITS clause or ALTER TABLE
statement to add the inheritance? Anyways, the answer to your
question is no, you'll need to create any dependencies to child
tables separately.

Erik Jones

Software Developer | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Markus Schiltknecht 2007-09-14 16:23:59 Re: Inherited FK Indexing
Previous Message Alan Hodgson 2007-09-14 16:21:51 Re: Inherited FK Indexing