pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Way <kevin.way@overtone.org>
To: pgsql-sql@postgresql.org
Subject: table inheritance and foreign key troubles
Date: Tue, 11 Sep 2001 08:04:52 +0000
Message-ID: <20010911080452.A76783@bean.overtone.org> (raw)

I'm having a little trouble with some inherited tables and a foreign key.  Here's
a simplified case, to show the trouble.

CREATE TABLE node (
    node_id     SERIAL NOT NULL,
    name        TEXT NOT NULL,
    PRIMARY KEY (node_id)
);
-- works just fine

CREATE TABLE users (
    email       TEXT NOT NULL
) INHERITS (node);
-- so far so good....

CREATE TABLE item (
    reason      TEXT NOT NULL,
    author_id   INT NOT NULL REFERENCES users (node_id)
) INHERITS (node);
ERROR:  UNIQUE constraint matching given keys for referenced table "users" not found

Does this operation just require differing syntax, because the referenced field
is inherited from another table, or is this not possible?

Kevin Way



view thread (5+ messages)  latest in thread

Message-ID: <20010911080452.A76783@bean.overtone.org>
Permalink:  ../20010911080452.A76783@bean.overtone.org/
Also on:    postgresql.org/message-id/20010911080452.A76783@bean.overtone.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kevin.way@overtone.org
  Subject: Re: table inheritance and foreign key troubles
  In-Reply-To: <20010911080452.A76783@bean.overtone.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox