Обсуждение: foreign key constraint not being respected with type created by CREATE TYPE

Поиск
Список
Период
Сортировка

foreign key constraint not being respected with type created by CREATE TYPE

От
H Hale
Дата:
Hello,

I have created a new data type using CREATE TYPE.
Foreign keys constaints are not being respected with
columns using the new type. As far as I can tell the
new type is working correctly except for foreign keys.
May be I have missed something when defining the new
type. Is there something specific that needs to be
done so that columns using the new type can be used as
foreign keys?
Thanks

CREATE TYPE X (
    INTERNALLENGTH = 16,
    INPUT          = X_in,
    OUTPUT         = X_out,
   RECEIVE        = X_recv,
   SEND           = X_send,
   alignment      = CHAR
);

CREATE OPERATOR CLASS X_ops
DEFAULT FOR TYPE uuid USING btree
AS
        OPERATOR        1       < ,
        OPERATOR        2       <= ,
        OPERATOR        3       = ,
        OPERATOR        4       >= ,
        OPERATOR        5       > ,
        FUNCTION        1       X_cmp(X, X);




__________________________________
Discover Yahoo!
Find restaurants, movies, travel and more fun for the weekend. Check it out!
http://discover.yahoo.com/weekend.html


Re: foreign key constraint not being respected with type created by CREATE TYPE

От
Tom Lane
Дата:
H Hale <hhale21@yahoo.com> writes:
> I have created a new data type using CREATE TYPE.
> Foreign keys constaints are not being respected with
> columns using the new type.

That hardly seems likely.  I'd look for bugs in your comparison
functions ;-)

            regards, tom lane

Re: foreign key constraint not being respected with type created by CREATE TYPE

От
H Hale
Дата:
It is likely if the foreign key was in a base table.
:)

Fairly new with PG and missed this minor but
significant detail (keys not inherited)



--- Tom Lane <tgl@sss.pgh.pa.us> wrote:

> H Hale <hhale21@yahoo.com> writes:
> > I have created a new data type using CREATE TYPE.
> > Foreign keys constaints are not being respected
> with
> > columns using the new type.
>
> That hardly seems likely.  I'd look for bugs in your
> comparison
> functions ;-)
>
>             regards, tom lane
>




__________________________________
Discover Yahoo!
Use Yahoo! to plan a weekend, have fun online and more. Check it out!
http://discover.yahoo.com/