summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorThomas Munro2021-05-07 08:17:42 +0000
committerThomas Munro2021-05-07 09:10:11 +0000
commitec48314708262d8ea6cdcb83f803fc83dd89e721 (patch)
treef5b7c82ea571ce78aaa355095dd588dce07349ff /src/include
parenta288d94c91e345ebeb10ac30f247270c8c8e380a (diff)
Revert per-index collation version tracking feature.
Design problems were discovered in the handling of composite types and record types that would cause some relevant versions not to be recorded. Misgivings were also expressed about the use of the pg_depend catalog for this purpose. We're out of time for this release so we'll revert and try again. Commits reverted: 1bf946bd: Doc: Document known problem with Windows collation versions. cf002008: Remove no-longer-relevant test case. ef387bed: Fix bogus collation-version-recording logic. 0fb0a050: Hide internal error for pg_collation_actual_version(<bad OID>). ff942057: Suppress "warning: variable 'collcollate' set but not used". d50e3b1f: Fix assertion in collation version lookup. f24b1569: Rethink extraction of collation dependencies. 257836a7: Track collation versions for indexes. cd6f479e: Add pg_depend.refobjversion. 7d1297df: Remove pg_collation.collversion. Discussion: https://postgr.es/m/CA%2BhUKGLhj5t1fcjqAu8iD9B3ixJtsTNqyCCD4V0aTO9kAKAjjA%40mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/catversion.h2
-rw-r--r--src/include/catalog/dependency.h20
-rw-r--r--src/include/catalog/index.h3
-rw-r--r--src/include/catalog/pg_collation.h8
-rw-r--r--src/include/catalog/pg_depend.h5
-rw-r--r--src/include/catalog/pg_type.h2
-rw-r--r--src/include/commands/collationcmds.h1
-rw-r--r--src/include/nodes/parsenodes.h13
-rw-r--r--src/include/utils/pg_locale.h2
-rw-r--r--src/include/utils/rel.h1
10 files changed, 25 insertions, 32 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 22dcd0a270c..a54be88d7f1 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202104271
+#define CATALOG_VERSION_NO 202105051
#endif
diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h
index f272e2c99f8..fd44081e741 100644
--- a/src/include/catalog/dependency.h
+++ b/src/include/catalog/dependency.h
@@ -167,8 +167,7 @@ extern void recordDependencyOnSingleRelExpr(const ObjectAddress *depender,
Node *expr, Oid relId,
DependencyType behavior,
DependencyType self_behavior,
- bool reverse_self,
- bool record_version);
+ bool reverse_self);
extern ObjectClass getObjectClass(const ObjectAddress *object);
@@ -188,30 +187,16 @@ extern void sort_object_addresses(ObjectAddresses *addrs);
extern void free_object_addresses(ObjectAddresses *addrs);
-typedef bool(*VisitDependenciesOfCB) (const ObjectAddress *otherObject,
- const char *version,
- char **new_version,
- void *data);
-
-extern void visitDependenciesOf(const ObjectAddress *object,
- VisitDependenciesOfCB callback,
- void *data);
-
/* in pg_depend.c */
extern void recordDependencyOn(const ObjectAddress *depender,
const ObjectAddress *referenced,
DependencyType behavior);
-extern void recordDependencyOnCollations(ObjectAddress *myself,
- List *collations,
- bool record_version);
-
extern void recordMultipleDependencies(const ObjectAddress *depender,
const ObjectAddress *referenced,
int nreferenced,
- DependencyType behavior,
- bool record_version);
+ DependencyType behavior);
extern void recordDependencyOnCurrentExtension(const ObjectAddress *object,
bool isReplace);
@@ -232,6 +217,7 @@ extern long changeDependencyFor(Oid classId, Oid objectId,
extern long changeDependenciesOf(Oid classId, Oid oldObjectId,
Oid newObjectId);
+
extern long changeDependenciesOn(Oid refClassId, Oid oldRefObjectId,
Oid newRefObjectId);
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index e22d506436b..008f723e104 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -136,9 +136,6 @@ extern void FormIndexDatum(IndexInfo *indexInfo,
Datum *values,
bool *isnull);
-extern void index_check_collation_versions(Oid relid);
-extern void index_update_collation_versions(Oid relid, Oid coll);
-
extern void index_build(Relation heapRelation,
Relation indexRelation,
IndexInfo *indexInfo,
diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h
index c6394ca2221..52bfd2cb7bf 100644
--- a/src/include/catalog/pg_collation.h
+++ b/src/include/catalog/pg_collation.h
@@ -41,6 +41,11 @@ CATALOG(pg_collation,3456,CollationRelationId)
int32 collencoding; /* encoding for this collation; -1 = "all" */
NameData collcollate; /* LC_COLLATE setting */
NameData collctype; /* LC_CTYPE setting */
+#ifdef CATALOG_VARLEN /* variable-length fields start here */
+ text collversion BKI_DEFAULT(_null_); /* provider-dependent */
+ /* version of */
+ /* collation data */
+#endif
} FormData_pg_collation;
/* ----------------
@@ -50,6 +55,8 @@ CATALOG(pg_collation,3456,CollationRelationId)
*/
typedef FormData_pg_collation *Form_pg_collation;
+DECLARE_TOAST(pg_collation, 8888, 8889);
+
DECLARE_UNIQUE_INDEX(pg_collation_name_enc_nsp_index, 3164, on pg_collation using btree(collname name_ops, collencoding int4_ops, collnamespace oid_ops));
#define CollationNameEncNspIndexId 3164
DECLARE_UNIQUE_INDEX_PKEY(pg_collation_oid_index, 3085, on pg_collation using btree(oid oid_ops));
@@ -70,6 +77,7 @@ extern Oid CollationCreate(const char *collname, Oid collnamespace,
bool collisdeterministic,
int32 collencoding,
const char *collcollate, const char *collctype,
+ const char *collversion,
bool if_not_exists,
bool quiet);
diff --git a/src/include/catalog/pg_depend.h b/src/include/catalog/pg_depend.h
index 606a2a8e192..e0bc1141457 100644
--- a/src/include/catalog/pg_depend.h
+++ b/src/include/catalog/pg_depend.h
@@ -63,9 +63,6 @@ CATALOG(pg_depend,2608,DependRelationId)
* field. See DependencyType in catalog/dependency.h.
*/
char deptype; /* see codes in dependency.h */
-#ifdef CATALOG_VARLEN
- text refobjversion; /* version of referenced object */
-#endif
} FormData_pg_depend;
/* ----------------
@@ -75,8 +72,6 @@ CATALOG(pg_depend,2608,DependRelationId)
*/
typedef FormData_pg_depend *Form_pg_depend;
-DECLARE_TOAST(pg_depend, 8888, 8889);
-
DECLARE_INDEX(pg_depend_depender_index, 2673, on pg_depend using btree(classid oid_ops, objid oid_ops, objsubid int4_ops));
#define DependDependerIndexId 2673
DECLARE_INDEX(pg_depend_reference_index, 2674, on pg_depend using btree(refclassid oid_ops, refobjid oid_ops, refobjsubid int4_ops));
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 8ee5fa0507a..33557760e19 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -390,8 +390,6 @@ extern void GenerateTypeDependencies(HeapTuple typeTuple,
bool isDependentType,
bool rebuild);
-extern List *GetTypeCollations(Oid typeObjectid);
-
extern void RenameTypeInternal(Oid typeOid, const char *newTypeName,
Oid typeNamespace);
diff --git a/src/include/commands/collationcmds.h b/src/include/commands/collationcmds.h
index 4e690458805..e49a5db0fbd 100644
--- a/src/include/commands/collationcmds.h
+++ b/src/include/commands/collationcmds.h
@@ -20,5 +20,6 @@
extern ObjectAddress DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_exists);
extern void IsThereCollationInNamespace(const char *collname, Oid nspOid);
+extern ObjectAddress AlterCollation(AlterCollationStmt *stmt);
#endif /* COLLATIONCMDS_H */
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 615dfa26aa2..fea31232519 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -1933,7 +1933,6 @@ typedef enum AlterTableType
AT_AddIdentity, /* ADD IDENTITY */
AT_SetIdentity, /* SET identity column options */
AT_DropIdentity, /* DROP IDENTITY */
- AT_AlterCollationRefreshVersion, /* ALTER COLLATION ... REFRESH VERSION */
AT_ReAddStatistics /* internal to commands/tablecmds.c */
} AlterTableType;
@@ -1950,7 +1949,6 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
AlterTableType subtype; /* Type of table alteration to apply */
char *name; /* column, constraint, or trigger to act on,
* or tablespace */
- List *object; /* collation to act on if it's a collation */
int16 num; /* attribute number for columns referenced by
* number */
RoleSpec *newowner;
@@ -1962,6 +1960,17 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */
/* ----------------------
+ * Alter Collation
+ * ----------------------
+ */
+typedef struct AlterCollationStmt
+{
+ NodeTag type;
+ List *collname;
+} AlterCollationStmt;
+
+
+/* ----------------------
* Alter Domain
*
* The fields are used in different ways by the different variants of
diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index 5a37caefbe4..2946f46c76f 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -103,7 +103,7 @@ typedef struct pg_locale_struct *pg_locale_t;
extern pg_locale_t pg_newlocale_from_collation(Oid collid);
-extern char *get_collation_version_for_oid(Oid collid, bool missing_ok);
+extern char *get_collation_actual_version(char collprovider, const char *collcollate);
#ifdef USE_ICU
extern int32_t icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index 5bd44be9a79..774ac5b2b19 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -63,7 +63,6 @@ typedef struct RelationData
bool rd_indexvalid; /* is rd_indexlist valid? (also rd_pkindex and
* rd_replidindex) */
bool rd_statvalid; /* is rd_statlist valid? */
- bool rd_version_checked; /* has version check been done yet? */
/*----------
* rd_createSubid is the ID of the highest subtransaction the rel has