Skip site navigation (1) Skip section navigation (2)

bug in 8.3? foreign key refers to different type

From: craigp <craigp98072(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: bug in 8.3? foreign key refers to different type
Date: 2008-02-27 00:27:26
Message-ID: 788837.69691.qm@web53910.mail.re2.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-general
These create table commands succeed, even tho the foreign key refers to a 'different' type (int2 product_id column refers to an int8 column):

CREATE TABLE products (
    id int8 primary key,
    name text not null
);

CREATE TABLE orders (
    id int8 PRIMARY KEY,
    product_id int2 not null REFERENCES products (id)
);

If I replace int2 with numeric, real, text, etc it fails as expected ("key columns are of incompatible types"). 

Expected: integer types should match exactly (or at least be large enough to hold the referenced value).

thanks,
--craig





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

Responses

pgsql-general by date

Next:From: Stephan SzaboDate: 2008-02-27 01:18:04
Subject: Re: bug in 8.3? foreign key refers to different type
Previous:From: Joris DobbelsteenDate: 2008-02-26 23:51:34
Subject: Re: win32: how to backup (dump does not work)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group