pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@zort.ca>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Domains and Indexes
Date: 11 Aug 2002 17:15:47 -0400
Message-ID: <1029100548.239.7.camel@jester> (raw)

Appears there is a problem finding the opclass when indexing a domain.

CREATE DOMAIN newint as int4;
CREATE TABLE tab (col newint unique);
ERROR:  data type newint has no default operator class for access method
"btree"
	You must specify an operator class for the index or define a
	default operator class for the data type


Specifically, GetDefaultOpClass() finds 0 exact matches and 3 binary
compatible matches.  Fetching getBaseType() of the attribute fixes the
problem for domains (see attachment).

However, I have to wonder why GetDefaultOpClass doesn't simply use the
first Binary Compatible opclass.  When there is more than one usable it
doesn't do anything useful.

Attachments:

index.patch (text/x-patch, 698B) download Index: src/backend/commands/indexcmds.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/indexcmds.c,v retrieving revision 1.80 diff -c -r1.80 indexcmds.c *** src/backend/commands/indexcmds.c 2002/08/02 18:15:06 1.80 --- src/backend/commands/indexcmds.c 2002/08/11 21:14:13 *************** *** 482,487 **** --- 482,490 ---- Oid exactOid = InvalidOid; Oid compatibleOid = InvalidOid; + /* It could be a domain */ + attrType = getBaseType(attrType); + /* * We scan through all the opclasses available for the access method, * looking for one that is marked default and matches the target type

view thread (8+ messages)  latest in thread

Message-ID: <1029100548.239.7.camel@jester>
Permalink:  ../1029100548.239.7.camel@jester/
Also on:    postgresql.org/message-id/1029100548.239.7.camel@jester

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: rbt@zort.ca
  Subject: Re: Domains and Indexes
  In-Reply-To: <1029100548.239.7.camel@jester>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox