Official Bug Report / attachment - Mailing list pgsql-bugs

From Bernie Huang
Subject Official Bug Report / attachment
Date
Msg-id 39493FD8.570233F8@ec.gc.ca
Whole thread Raw
List pgsql-bugs
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports@postgresql.org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs@postgresql.org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches@postgresql.org instead.  Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        :    Bernie Huang
Your email address    :    Bernie.Huang@ec.gc.ca


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :    Intel PIII

  Operating System (example: Linux 2.0.26 ELF)     :    RH Linux 6.2

  PostgreSQL version (example: PostgreSQL-6.5.1):    PostgreSQL-7.0

  Compiler used (example:  gcc 2.8.0)        :    Don't know


Please enter a FULL description of your problem:
------------------------------------------------
When you inherit table B from table A, the primary key in A won't be
inherited to B, but only the columns.

I was wondering how do you inherit a primary key or, even, a foreign
key?  If it's not possible, what are the ways going around it?  (not
null index or...???)

Thanks for your help!

- Bernie


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
CREATE TABLE parent (
  col1 INT4 PRIMARY KEY,
  col2 text);

CREATE TABLE child (
  col3 text) inherits (parent);

CREATE TABLE foreign_to_child (
  col1 INT4,
  FOREIGN KEY (col1) REFERENCES child
    ON UPDATE CASCADE
    ON DELETE SET NULL);


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
I tried using not null index on the column that's supposed to be the
primary key in the child table, but failed to work.
Attachment

pgsql-bugs by date:

Previous
From: Bernie Huang
Date:
Subject: BUG?! primary key in inherited table
Next
From: Javier Quiles
Date:
Subject: ERROR: CREATE DATABASE