Re: Foreign key type checking patch

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Foreign key type checking patch
Date: 2004-03-01 17:58:43
Message-ID: Pine.LNX.4.58.0403011823500.28778@sablons.cri.ensmp.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Dear Tom,

Thanks for your reply.

> > Here is a proposed patch against 7.4.1 to check exact match
> > of foreign key types wrt the referenced keys, and to show
> > a warning if this is not the case.
>
> I think that this concern may be obsolete in CVS tip,

I just get the current CVS and had a quick look at it.

> at least for the cases where we have indexable cross-type operators.
> The correct way to do this would be to look at the operator found by
> oper() and see whether it's indexable.

I must admit that I do not understand your point.

I wish I would have a WARNING if a foreign key is not declared exactly as
the key it references. I think that it is a desirable feature for stupid
users, including myself!

I cannot see why whether the "=" comparison version which is chosen is
indexable or not would lead to this information. It seems quite
reasonnable to look directly at the attribute types and compare them for
this purpose.

I noticed the compatible_oper() function which would return a no-coersion
binary operator between types. However that does not fit my purpose. For
instance, it seems to me that the IsBinaryCoercible returns true for
VARCHAR(12) and VARCHAR(16), as the type oid is the same, but I think a
warning makes sense anyway. So it is not the same issue.

So I can't see your point. Maybe some more lights would help?

--
Fabien.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-03-01 18:11:59 Re: Foreign key type checking patch
Previous Message Josh Berkus 2004-03-01 17:46:08 Re: [HACKERS] Collaboration Tool Proposal -- Summary to date

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2004-03-01 18:01:15 minor doc improvement
Previous Message Tom Lane 2004-03-01 16:54:07 Re: Foreign key type checking patch