Skip to content

Commit 46aaa5d

Browse files
committed
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). Rod Taylor
1 parent 45e2544 commit 46aaa5d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/backend/commands/indexcmds.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.81 2002/08/07 21:45:01 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.82 2002/08/15 02:53:35 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -482,6 +482,9 @@ GetDefaultOpClass(Oid attrType, Oid accessMethodId)
482482
Oid exactOid = InvalidOid;
483483
Oid compatibleOid = InvalidOid;
484484

485+
/* It could be a domain */
486+
attrType = getBaseType(attrType);
487+
485488
/*
486489
* We scan through all the opclasses available for the access method,
487490
* looking for one that is marked default and matches the target type

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy