Re: Foreign keys for non-default datatypes

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: elein <elein(at)varlena(dot)com>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-hackers(at)postgresql(dot)org, CG <cgg007(at)yahoo(dot)com>
Subject: Re: Foreign keys for non-default datatypes
Date: 2006-03-03 20:51:09
Message-ID: 20060303205109.GG5152@varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 02, 2006 at 08:41:20PM -0500, Tom Lane wrote:
> elein <elein(at)varlena(dot)com> writes:
> > ... What I'm saying is that the opclass needs to be
> > an option to PRIMARY KEY and FOREIGN KEY--
>
> PRIMARY KEY and UNIQUE, you mean.
>
> This was brought up before, but I remain less than excited about it.
> You can get essentially the same functionality by doing a CREATE UNIQUE
> INDEX command, so allowing it as part of the PK/UNIQUE syntax is little
> more than syntactic sugar. I'm concerned that wedging opclass names
> into that syntax could come back to haunt us some day --- eg, if SQL2009
> decides to put their own kind of option into the same syntactic spot.
>
> > The case in point is a subtype (domain) with a BTREE operator class.
> > I can of course create a separate unique index, however, if I use the
> > PRIMARY KEY syntax the op class of the data type is not recognized.
>
> Hm, does CREATE INDEX work without explicitly specifying the opclass?
> I suspect your complaint really stems from overeager getBaseType() calls
> in the index definition code, which is maybe fixable without having to
> get into syntactic extensions.

I am also leary of syntactic extensions. I've found at least one getbasetype
to be misplaced rather than over eager. But I'm looking at these issues
as I have time available.

>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-03-03 21:11:49 Re: Foreign keys for non-default datatypes
Previous Message Bruce Momjian 2006-03-03 20:40:38 Re: drop if exists remainder