summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2002-04-17 20:57:57 +0000
committerTom Lane2002-04-17 20:57:57 +0000
commit27a54ae282d74ee471a5b34d136fe3d4f894a9de (patch)
tree59aedb6b78d8b4ff8f26f6a945799a443dd6d571 /src/include
parentd85a81cbc384614eec525ca19e1cf48687643725 (diff)
Opclasses live in namespaces. I also took the opportunity to create
an 'opclass owner' column in pg_opclass. Nothing is done with it at present, but since there are plans to invent a CREATE OPERATOR CLASS command soon, we'll probably want DROP OPERATOR CLASS too, which suggests that a notion of ownership would be a good idea.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/indexing.h6
-rw-r--r--src/include/catalog/namespace.h21
-rw-r--r--src/include/catalog/pg_opclass.h116
-rw-r--r--src/include/nodes/parsenodes.h4
-rw-r--r--src/include/utils/syscache.h4
6 files changed, 89 insertions, 66 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 4b0d011b3d6..492c3e9b3fe 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: catversion.h,v 1.116 2002/04/16 23:08:11 tgl Exp $
+ * $Id: catversion.h,v 1.117 2002/04/17 20:57:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 200204161
+#define CATALOG_VERSION_NO 200204171
#endif
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index 4ca83c54273..b2b3f1f39c7 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: indexing.h,v 1.63 2002/04/16 23:08:11 tgl Exp $
+ * $Id: indexing.h,v 1.64 2002/04/17 20:57:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,7 @@
#define LargeObjectLOidPNIndex "pg_largeobject_loid_pn_index"
#define NamespaceNameIndex "pg_namespace_nspname_index"
#define NamespaceOidIndex "pg_namespace_oid_index"
-#define OpclassAmNameIndex "pg_opclass_am_name_index"
+#define OpclassAmNameNspIndex "pg_opclass_am_name_nsp_index"
#define OpclassOidIndex "pg_opclass_oid_index"
#define OperatorNameNspIndex "pg_operator_oprname_l_r_n_index"
#define OperatorOidIndex "pg_operator_oid_index"
@@ -169,7 +169,7 @@ DECLARE_UNIQUE_INDEX(pg_language_oid_index on pg_language using btree(oid oid_op
DECLARE_UNIQUE_INDEX(pg_largeobject_loid_pn_index on pg_largeobject using btree(loid oid_ops, pageno int4_ops));
DECLARE_UNIQUE_INDEX(pg_namespace_nspname_index on pg_namespace using btree(nspname name_ops));
DECLARE_UNIQUE_INDEX(pg_namespace_oid_index on pg_namespace using btree(oid oid_ops));
-DECLARE_UNIQUE_INDEX(pg_opclass_am_name_index on pg_opclass using btree(opcamid oid_ops, opcname name_ops));
+DECLARE_UNIQUE_INDEX(pg_opclass_am_name_nsp_index on pg_opclass using btree(opcamid oid_ops, opcname name_ops, opcnamespace oid_ops));
DECLARE_UNIQUE_INDEX(pg_opclass_oid_index on pg_opclass using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_operator_oid_index on pg_operator using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_operator_oprname_l_r_n_index on pg_operator using btree(oprname name_ops, oprleft oid_ops, oprright oid_ops, oprnamespace oid_ops));
diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h
index d69e1da58b7..148fc210a88 100644
--- a/src/include/catalog/namespace.h
+++ b/src/include/catalog/namespace.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: namespace.h,v 1.8 2002/04/16 23:08:11 tgl Exp $
+ * $Id: namespace.h,v 1.9 2002/04/17 20:57:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,21 @@ typedef struct _FuncCandidateList
Oid args[1]; /* arg types --- VARIABLE LENGTH ARRAY */
} *FuncCandidateList; /* VARIABLE LENGTH STRUCT */
+/*
+ * This structure holds a list of opclass candidates found by namespace
+ * lookup.
+ */
+typedef struct _OpclassCandidateList
+{
+ struct _OpclassCandidateList *next;
+ char *opcname_tmp; /* for internal use of namespace lookup */
+ int pathpos; /* for internal use of namespace lookup */
+ Oid oid; /* the opclass's OID */
+ Oid opcintype; /* type of input data for opclass */
+ bool opcdefault; /* T if opclass is default for opcintype */
+ Oid opckeytype; /* type of index data, or InvalidOid */
+} *OpclassCandidateList;
+
extern Oid RangeVarGetRelid(const RangeVar *relation, bool failOK);
@@ -41,10 +56,14 @@ extern Oid RelnameGetRelid(const char *relname);
extern Oid TypenameGetTypid(const char *typname);
+extern Oid OpclassnameGetOpcid(Oid amid, const char *opcname);
+
extern FuncCandidateList FuncnameGetCandidates(List *names, int nargs);
extern FuncCandidateList OpernameGetCandidates(List *names, char oprkind);
+extern OpclassCandidateList OpclassGetCandidates(Oid amid);
+
extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
extern RangeVar *makeRangeVarFromNameList(List *names);
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 2e25e366c64..edb29267d62 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -26,7 +26,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_opclass.h,v 1.43 2001/11/05 17:46:32 momjian Exp $
+ * $Id: pg_opclass.h,v 1.44 2002/04/17 20:57:56 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -54,6 +54,8 @@ CATALOG(pg_opclass)
{
Oid opcamid; /* index access method opclass is for */
NameData opcname; /* name of this opclass */
+ Oid opcnamespace; /* namespace of this opclass */
+ int4 opcowner; /* opclass owner */
Oid opcintype; /* type of input data for opclass */
bool opcdefault; /* T if opclass is default for opcintype */
Oid opckeytype; /* type of index data, or InvalidOid */
@@ -70,71 +72,73 @@ typedef FormData_pg_opclass *Form_pg_opclass;
* compiler constants for pg_opclass
* ----------------
*/
-#define Natts_pg_opclass 5
+#define Natts_pg_opclass 7
#define Anum_pg_opclass_opcamid 1
#define Anum_pg_opclass_opcname 2
-#define Anum_pg_opclass_opcintype 3
-#define Anum_pg_opclass_opcdefault 4
-#define Anum_pg_opclass_opckeytype 5
+#define Anum_pg_opclass_opcnamespace 3
+#define Anum_pg_opclass_opcowner 4
+#define Anum_pg_opclass_opcintype 5
+#define Anum_pg_opclass_opcdefault 6
+#define Anum_pg_opclass_opckeytype 7
/* ----------------
* initial contents of pg_opclass
* ----------------
*/
-DATA(insert OID = 421 ( 403 abstime_ops 702 t 0 ));
-DATA(insert OID = 422 ( 402 bigbox_ops 603 f 0 ));
-DATA(insert OID = 423 ( 403 bit_ops 1560 t 0 ));
-DATA(insert OID = 424 ( 403 bool_ops 16 t 0 ));
-DATA(insert OID = 425 ( 402 box_ops 603 t 0 ));
-DATA(insert OID = 426 ( 403 bpchar_ops 1042 t 0 ));
-DATA(insert OID = 427 ( 405 bpchar_ops 1042 t 0 ));
-DATA(insert OID = 428 ( 403 bytea_ops 17 t 0 ));
-DATA(insert OID = 429 ( 403 char_ops 18 t 0 ));
-DATA(insert OID = 431 ( 405 char_ops 18 t 0 ));
-DATA(insert OID = 432 ( 403 cidr_ops 650 t 0 ));
-DATA(insert OID = 433 ( 405 cidr_ops 650 t 0 ));
-DATA(insert OID = 434 ( 403 date_ops 1082 t 0 ));
-DATA(insert OID = 435 ( 405 date_ops 1082 t 0 ));
-DATA(insert OID = 1970 ( 403 float4_ops 700 t 0 ));
-DATA(insert OID = 1971 ( 405 float4_ops 700 t 0 ));
-DATA(insert OID = 1972 ( 403 float8_ops 701 t 0 ));
-DATA(insert OID = 1973 ( 405 float8_ops 701 t 0 ));
-DATA(insert OID = 1974 ( 403 inet_ops 869 t 0 ));
-DATA(insert OID = 1975 ( 405 inet_ops 869 t 0 ));
-DATA(insert OID = 1976 ( 403 int2_ops 21 t 0 ));
+DATA(insert OID = 421 ( 403 abstime_ops PGNSP PGUID 702 t 0 ));
+DATA(insert OID = 422 ( 402 bigbox_ops PGNSP PGUID 603 f 0 ));
+DATA(insert OID = 423 ( 403 bit_ops PGNSP PGUID 1560 t 0 ));
+DATA(insert OID = 424 ( 403 bool_ops PGNSP PGUID 16 t 0 ));
+DATA(insert OID = 425 ( 402 box_ops PGNSP PGUID 603 t 0 ));
+DATA(insert OID = 426 ( 403 bpchar_ops PGNSP PGUID 1042 t 0 ));
+DATA(insert OID = 427 ( 405 bpchar_ops PGNSP PGUID 1042 t 0 ));
+DATA(insert OID = 428 ( 403 bytea_ops PGNSP PGUID 17 t 0 ));
+DATA(insert OID = 429 ( 403 char_ops PGNSP PGUID 18 t 0 ));
+DATA(insert OID = 431 ( 405 char_ops PGNSP PGUID 18 t 0 ));
+DATA(insert OID = 432 ( 403 cidr_ops PGNSP PGUID 650 t 0 ));
+DATA(insert OID = 433 ( 405 cidr_ops PGNSP PGUID 650 t 0 ));
+DATA(insert OID = 434 ( 403 date_ops PGNSP PGUID 1082 t 0 ));
+DATA(insert OID = 435 ( 405 date_ops PGNSP PGUID 1082 t 0 ));
+DATA(insert OID = 1970 ( 403 float4_ops PGNSP PGUID 700 t 0 ));
+DATA(insert OID = 1971 ( 405 float4_ops PGNSP PGUID 700 t 0 ));
+DATA(insert OID = 1972 ( 403 float8_ops PGNSP PGUID 701 t 0 ));
+DATA(insert OID = 1973 ( 405 float8_ops PGNSP PGUID 701 t 0 ));
+DATA(insert OID = 1974 ( 403 inet_ops PGNSP PGUID 869 t 0 ));
+DATA(insert OID = 1975 ( 405 inet_ops PGNSP PGUID 869 t 0 ));
+DATA(insert OID = 1976 ( 403 int2_ops PGNSP PGUID 21 t 0 ));
#define INT2_BTREE_OPS_OID 1976
-DATA(insert OID = 1977 ( 405 int2_ops 21 t 0 ));
-DATA(insert OID = 1978 ( 403 int4_ops 23 t 0 ));
+DATA(insert OID = 1977 ( 405 int2_ops PGNSP PGUID 21 t 0 ));
+DATA(insert OID = 1978 ( 403 int4_ops PGNSP PGUID 23 t 0 ));
#define INT4_BTREE_OPS_OID 1978
-DATA(insert OID = 1979 ( 405 int4_ops 23 t 0 ));
-DATA(insert OID = 1980 ( 403 int8_ops 20 t 0 ));
-DATA(insert OID = 1981 ( 405 int8_ops 20 t 0 ));
-DATA(insert OID = 1982 ( 403 interval_ops 1186 t 0 ));
-DATA(insert OID = 1983 ( 405 interval_ops 1186 t 0 ));
-DATA(insert OID = 1984 ( 403 macaddr_ops 829 t 0 ));
-DATA(insert OID = 1985 ( 405 macaddr_ops 829 t 0 ));
-DATA(insert OID = 1986 ( 403 name_ops 19 t 0 ));
-DATA(insert OID = 1987 ( 405 name_ops 19 t 0 ));
-DATA(insert OID = 1988 ( 403 numeric_ops 1700 t 0 ));
-DATA(insert OID = 1989 ( 403 oid_ops 26 t 0 ));
+DATA(insert OID = 1979 ( 405 int4_ops PGNSP PGUID 23 t 0 ));
+DATA(insert OID = 1980 ( 403 int8_ops PGNSP PGUID 20 t 0 ));
+DATA(insert OID = 1981 ( 405 int8_ops PGNSP PGUID 20 t 0 ));
+DATA(insert OID = 1982 ( 403 interval_ops PGNSP PGUID 1186 t 0 ));
+DATA(insert OID = 1983 ( 405 interval_ops PGNSP PGUID 1186 t 0 ));
+DATA(insert OID = 1984 ( 403 macaddr_ops PGNSP PGUID 829 t 0 ));
+DATA(insert OID = 1985 ( 405 macaddr_ops PGNSP PGUID 829 t 0 ));
+DATA(insert OID = 1986 ( 403 name_ops PGNSP PGUID 19 t 0 ));
+DATA(insert OID = 1987 ( 405 name_ops PGNSP PGUID 19 t 0 ));
+DATA(insert OID = 1988 ( 403 numeric_ops PGNSP PGUID 1700 t 0 ));
+DATA(insert OID = 1989 ( 403 oid_ops PGNSP PGUID 26 t 0 ));
#define OID_BTREE_OPS_OID 1989
-DATA(insert OID = 1990 ( 405 oid_ops 26 t 0 ));
-DATA(insert OID = 1991 ( 403 oidvector_ops 30 t 0 ));
-DATA(insert OID = 1992 ( 405 oidvector_ops 30 t 0 ));
-DATA(insert OID = 1993 ( 402 poly_ops 604 t 0 ));
-DATA(insert OID = 1994 ( 403 text_ops 25 t 0 ));
-DATA(insert OID = 1995 ( 405 text_ops 25 t 0 ));
-DATA(insert OID = 1996 ( 403 time_ops 1083 t 0 ));
-DATA(insert OID = 1997 ( 405 time_ops 1083 t 0 ));
-DATA(insert OID = 1998 ( 403 timestamptz_ops 1184 t 0 ));
-DATA(insert OID = 1999 ( 405 timestamptz_ops 1184 t 0 ));
-DATA(insert OID = 2000 ( 403 timetz_ops 1266 t 0 ));
-DATA(insert OID = 2001 ( 405 timetz_ops 1266 t 0 ));
-DATA(insert OID = 2002 ( 403 varbit_ops 1562 t 0 ));
-DATA(insert OID = 2003 ( 403 varchar_ops 1043 t 0 ));
-DATA(insert OID = 2004 ( 405 varchar_ops 1043 t 0 ));
-DATA(insert OID = 2039 ( 403 timestamp_ops 1114 t 0 ));
-DATA(insert OID = 2040 ( 405 timestamp_ops 1114 t 0 ));
+DATA(insert OID = 1990 ( 405 oid_ops PGNSP PGUID 26 t 0 ));
+DATA(insert OID = 1991 ( 403 oidvector_ops PGNSP PGUID 30 t 0 ));
+DATA(insert OID = 1992 ( 405 oidvector_ops PGNSP PGUID 30 t 0 ));
+DATA(insert OID = 1993 ( 402 poly_ops PGNSP PGUID 604 t 0 ));
+DATA(insert OID = 1994 ( 403 text_ops PGNSP PGUID 25 t 0 ));
+DATA(insert OID = 1995 ( 405 text_ops PGNSP PGUID 25 t 0 ));
+DATA(insert OID = 1996 ( 403 time_ops PGNSP PGUID 1083 t 0 ));
+DATA(insert OID = 1997 ( 405 time_ops PGNSP PGUID 1083 t 0 ));
+DATA(insert OID = 1998 ( 403 timestamptz_ops PGNSP PGUID 1184 t 0 ));
+DATA(insert OID = 1999 ( 405 timestamptz_ops PGNSP PGUID 1184 t 0 ));
+DATA(insert OID = 2000 ( 403 timetz_ops PGNSP PGUID 1266 t 0 ));
+DATA(insert OID = 2001 ( 405 timetz_ops PGNSP PGUID 1266 t 0 ));
+DATA(insert OID = 2002 ( 403 varbit_ops PGNSP PGUID 1562 t 0 ));
+DATA(insert OID = 2003 ( 403 varchar_ops PGNSP PGUID 1043 t 0 ));
+DATA(insert OID = 2004 ( 405 varchar_ops PGNSP PGUID 1043 t 0 ));
+DATA(insert OID = 2039 ( 403 timestamp_ops PGNSP PGUID 1114 t 0 ));
+DATA(insert OID = 2040 ( 405 timestamp_ops PGNSP PGUID 1114 t 0 ));
#endif /* PG_OPCLASS_H */
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 7fe606825e4..ba9ed9aa8de 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.170 2002/04/16 23:08:12 tgl Exp $
+ * $Id: parsenodes.h,v 1.171 2002/04/17 20:57:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -401,7 +401,7 @@ typedef struct IndexElem
char *name; /* name of attribute to index, or NULL */
List *funcname; /* qualified name of function */
List *args; /* list of names of function arguments */
- char *class; /* name of desired opclass; NULL = default */
+ List *opclass; /* name of desired opclass; NIL = default */
} IndexElem;
/*
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index e567a8b22b6..dbe50b37be6 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.45 2002/04/16 23:08:12 tgl Exp $
+ * $Id: syscache.h,v 1.46 2002/04/17 20:57:57 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,7 +36,7 @@
#define AMPROCNUM 5
#define ATTNAME 6
#define ATTNUM 7
-#define CLAAMNAME 8
+#define CLAAMNAMENSP 8
#define CLAOID 9
#define GRONAME 10
#define GROSYSID 11