1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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
This commit is contained in:
Thomas Munro
2021-05-07 20:17:42 +12:00
parent a288d94c91
commit ec48314708
55 changed files with 463 additions and 1354 deletions

View File

@ -45,7 +45,6 @@
#include "catalog/pg_am_d.h"
#include "catalog/pg_class_d.h"
#include "catalog/pg_collation_d.h"
#include "common.h"
#include "libpq-fe.h"
#include "pqexpbuffer.h"
@ -842,20 +841,6 @@ static const SchemaQuery Query_for_list_of_collations = {
" (SELECT tgrelid FROM pg_catalog.pg_trigger "\
" WHERE pg_catalog.quote_ident(tgname)='%s')"
/* the silly-looking length condition is just to eat up the current word */
#define Query_for_list_of_colls_for_one_index \
" SELECT DISTINCT pg_catalog.quote_ident(coll.collname) " \
" FROM pg_catalog.pg_depend d, pg_catalog.pg_collation coll, " \
" pg_catalog.pg_class c" \
" WHERE (%d = pg_catalog.length('%s'))" \
" AND d.refclassid = " CppAsString2(CollationRelationId) \
" AND d.refobjid = coll.oid " \
" AND d.classid = " CppAsString2(RelationRelationId) \
" AND d.objid = c.oid " \
" AND c.relkind = " CppAsString2(RELKIND_INDEX) \
" AND pg_catalog.pg_table_is_visible(c.oid) " \
" AND c.relname = '%s'"
#define Query_for_list_of_ts_configurations \
"SELECT pg_catalog.quote_ident(cfgname) FROM pg_catalog.pg_ts_config "\
" WHERE substring(pg_catalog.quote_ident(cfgname),1,%d)='%s'"
@ -1769,15 +1754,14 @@ psql_completion(const char *text, int start, int end)
else if (Matches("ALTER", "INDEX", MatchAny))
COMPLETE_WITH("ALTER COLUMN", "OWNER TO", "RENAME TO", "SET",
"RESET", "ATTACH PARTITION",
"DEPENDS ON EXTENSION", "NO DEPENDS ON EXTENSION",
"ALTER COLLATION");
"DEPENDS ON EXTENSION", "NO DEPENDS ON EXTENSION");
else if (Matches("ALTER", "INDEX", MatchAny, "ATTACH"))
COMPLETE_WITH("PARTITION");
else if (Matches("ALTER", "INDEX", MatchAny, "ATTACH", "PARTITION"))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_indexes, NULL);
/* ALTER INDEX <name> ALTER */
else if (Matches("ALTER", "INDEX", MatchAny, "ALTER"))
COMPLETE_WITH("COLLATION", "COLUMN");
COMPLETE_WITH("COLUMN");
/* ALTER INDEX <name> ALTER COLUMN */
else if (Matches("ALTER", "INDEX", MatchAny, "ALTER", "COLUMN"))
{
@ -1816,15 +1800,10 @@ psql_completion(const char *text, int start, int end)
"buffering =", /* GiST */
"pages_per_range =", "autosummarize =" /* BRIN */
);
/* ALTER INDEX <name> ALTER COLLATION */
else if (Matches("ALTER", "INDEX", MatchAny, "ALTER", "COLLATION"))
{
completion_info_charp = prev3_wd;
COMPLETE_WITH_QUERY(Query_for_list_of_colls_for_one_index);
}
/* ALTER INDEX <name> ALTER COLLATION <name> */
else if (Matches("ALTER", "INDEX", MatchAny, "ALTER", "COLLATION", MatchAny))
COMPLETE_WITH("REFRESH VERSION");
else if (Matches("ALTER", "INDEX", MatchAny, "NO", "DEPENDS"))
COMPLETE_WITH("ON EXTENSION");
else if (Matches("ALTER", "INDEX", MatchAny, "DEPENDS"))
COMPLETE_WITH("ON EXTENSION");
/* ALTER LANGUAGE <name> */
else if (Matches("ALTER", "LANGUAGE", MatchAny))