Search Postgresql Archives

bug in 8.3? foreign key refers to different type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux