Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hqoBl-0000HY-Ta for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jul 2019 00:34:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hqoBj-0007Yr-Dz for pgsql-bugs@arkaria.postgresql.org; Fri, 26 Jul 2019 00:34:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hqoBj-0007Yk-5A for pgsql-bugs@lists.postgresql.org; Fri, 26 Jul 2019 00:34:23 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hqoBg-0007fQ-M5 for pgsql-bugs@lists.postgresql.org; Fri, 26 Jul 2019 00:34:22 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8398D4A4; Thu, 25 Jul 2019 20:34:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 Jul 2019 20:34:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=2XOwRI/zkPExhqTmM7QAo+jC4RW Z5aDspaqvyuY7Hio=; b=hvjRBRUBn1EQt9vjrpyuiu+/nymRP4VL0HakkZc7YNj d/Jw4U9/9YaSz82P5NuCt9lvIZdYrZe2wrHuQg2qiq8ke0Mqx+TsxSkKsZA3h7XW gCSEaimnuXkfZwZrkrf/k+HEOLxBrVcbqCTr7fi57vxOzs9nOcgw9O+O7NpJdqjW WMpcH13XwaE6PsfA9q5bXPTVFMU3q4kKhZPJcl0lOZ6LpYG9pLQVue69yLQqCaY8 /tiN9CjD/urcd8/X82Iap1A7THWTM5BqusTmBcHIEzJu615WH3MP4DMgh0UMotxh uVfxU7mmzyXyP4C4DbSrEzd51nP0feWleyapGW4eMSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=2XOwRI /zkPExhqTmM7QAo+jC4RWZ5aDspaqvyuY7Hio=; b=NbCYSqnWDC++gj9SxZQu6a nXdk4yncwlQxYemnV4AVLAFARXljOQ3CLvDWbkj7YAjC37OLICm/lDuYxaqZ59c5 AS3xish3/J/2OveMIByneXGRh/zTZktbBm+Xw3GPrTMC+Cto3nc3aTadfDdyxV5x u6br5pfaIykKojtrAY9hc3+3DY7VmK1rliyNTQrVBDMak4Q0tHaD77b5BagG2CoW +ZAGVECxbZX3huHj5x4InmfoPmsYBR3pxC1/YeiFHF+6YuLvrtDjxyUxW2MQ3jAC za7cZF031w3ePRpkfqbJP4hjo+mS7QzKAWlUYuZP+aDUhs3SbIuhYU0Qb19aO0iA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrkeefgdefhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecukfhppeduuddurddutddvrddukedtrddukeehnecurfgrrhgr mhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluh hsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 631E18005B; Thu, 25 Jul 2019 20:34:16 -0400 (EDT) Date: Fri, 26 Jul 2019 09:34:13 +0900 From: Michael Paquier To: Tom Lane Cc: Manuel Rigger , PostgreSQL mailing lists Subject: Re: REINDEX CONCURRENTLY causes ALTER TABLE to fail Message-ID: <20190726003413.GC7677@paquier.xyz> References: <20190718030232.GD1416@paquier.xyz> <20190718042543.GE1416@paquier.xyz> <20401.1563831686@sss.pgh.pa.us> <20190723042838.GB2059@paquier.xyz> <20190725103113.GB10546@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="M38YqGLZlgb6RLPS" Content-Disposition: inline In-Reply-To: <20190725103113.GB10546@paquier.xyz> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --M38YqGLZlgb6RLPS Content-Type: multipart/mixed; boundary="NU0Ex4SbNnrxsi6C" Content-Disposition: inline --NU0Ex4SbNnrxsi6C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Jul 25, 2019 at 07:31:13PM +0900, Michael Paquier wrote: > I have been looking at this code today and extended the test cases > with more expression and predicate indexes to stress more the patch, > and it happens that I am still stuck for with makeIndexInfo(). The > header comments of makefuncs.h and makefuncs.c mention primitive > nodes, so I would need at least to update that part to mention > execution nodes. Still I'd rather not have people scream at me as > that could be considered invasive in terms of included dependencies > for makefuncs.c :) After an extra round of polishing, I am finishing with the attached and the following change for makefuncs.h: * makefuncs.h - * prototypes for the creator functions (for primitive nodes) + * prototypes for the creator functions for various nodes Any objections with this version? Please note that the predicates and expressions are fetched directly from the catalogs, and that we does not rely on the relcache anymore. -- Michael --NU0Ex4SbNnrxsi6C Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="reindex-conc-predicates-v3.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 9234e93261..6aac64c4cf 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -1197,7 +1197,8 @@ Oid index_concurrently_create_copy(Relation heapRelation, Oid oldIndexId, cons= t char *newName) { Relation indexRelation; - IndexInfo *indexInfo; + IndexInfo *oldInfo, + *newInfo; Oid newIndexId =3D InvalidOid; HeapTuple indexTuple, classTuple; @@ -1208,11 +1209,22 @@ index_concurrently_create_copy(Relation heapRelatio= n, Oid oldIndexId, const char int2vector *indcoloptions; bool isnull; List *indexColNames =3D NIL; + List *indexExprs =3D NIL; + List *indexPreds =3D NIL; =20 indexRelation =3D index_open(oldIndexId, RowExclusiveLock); =20 - /* New index uses the same index information as old index */ - indexInfo =3D BuildIndexInfo(indexRelation); + /* The new index needs some information from the old index */ + oldInfo =3D BuildIndexInfo(indexRelation); + + /* + * Concurrent build of an index with exclusion constraints is not + * supported. + */ + if (oldInfo->ii_ExclusionOps !=3D NULL) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("concurrent index creation for exclusion constraints is not su= pported"))); =20 /* Get the array of class and column options IDs from index info */ indexTuple =3D SearchSysCache1(INDEXRELID, ObjectIdGetDatum(oldIndexId)); @@ -1236,14 +1248,64 @@ index_concurrently_create_copy(Relation heapRelatio= n, Oid oldIndexId, const char Anum_pg_class_reloptions, &isnull); =20 /* - * Extract the list of column names to be used for the index creation. + * Fetch the list of expressions and predicates directly from the + * catalogs. This cannot rely on the information from IndexInfo for the + * old index as these have been flattened for the planner. */ - for (int i =3D 0; i < indexInfo->ii_NumIndexAttrs; i++) + if (oldInfo->ii_Expressions !=3D NIL) + { + Datum exprDatum; + char *exprString; + + exprDatum =3D SysCacheGetAttr(INDEXRELID, indexTuple, + Anum_pg_index_indexprs, &isnull); + Assert(!isnull); + exprString =3D TextDatumGetCString(exprDatum); + indexExprs =3D (List *) stringToNode(exprString); + pfree(exprString); + } + if (oldInfo->ii_Predicate !=3D NIL) + { + Datum predDatum; + char *predString; + + predDatum =3D SysCacheGetAttr(INDEXRELID, indexTuple, + Anum_pg_index_indpred, &isnull); + Assert(!isnull); + predString =3D TextDatumGetCString(predDatum); + indexPreds =3D (List *) stringToNode(predString); + + /* Also convert to implicit-AND format */ + indexPreds =3D make_ands_implicit((Expr *) indexPreds); + pfree(predString); + } + + /* + * Build the index information for the new index. Note that rebuild of + * indexes with exclusion constraints is not supported, hence there is no + * need to fill all the ii_Exclusion* fields. + */ + newInfo =3D makeIndexInfo(oldInfo->ii_NumIndexAttrs, + oldInfo->ii_NumIndexKeyAttrs, + oldInfo->ii_Am, + indexExprs, + indexPreds, + oldInfo->ii_Unique, + false, /* not ready for inserts */ + true); + + /* + * Extract the list of column names and the column numbers for the new + * index information. All this information will be used for the index + * creation. + */ + for (int i =3D 0; i < oldInfo->ii_NumIndexAttrs; i++) { TupleDesc indexTupDesc =3D RelationGetDescr(indexRelation); Form_pg_attribute att =3D TupleDescAttr(indexTupDesc, i); =20 indexColNames =3D lappend(indexColNames, NameStr(att->attname)); + newInfo->ii_IndexAttrNumbers[i] =3D oldInfo->ii_IndexAttrNumbers[i]; } =20 /* @@ -1259,7 +1321,7 @@ index_concurrently_create_copy(Relation heapRelation,= Oid oldIndexId, const char InvalidOid, /* parentIndexRelid */ InvalidOid, /* parentConstraintId */ InvalidOid, /* relFileNode */ - indexInfo, + newInfo, indexColNames, indexRelation->rd_rel->relam, indexRelation->rd_rel->reltablespace, diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexc= mds.c index fd299273c5..8dc7a39870 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -202,18 +202,8 @@ CheckIndexCompatible(Oid oldId, * contains only key attributes, thus we're filling ii_NumIndexAttrs and * ii_NumIndexKeyAttrs with same value. */ - indexInfo =3D makeNode(IndexInfo); - indexInfo->ii_NumIndexAttrs =3D numberOfAttributes; - indexInfo->ii_NumIndexKeyAttrs =3D numberOfAttributes; - indexInfo->ii_Expressions =3D NIL; - indexInfo->ii_ExpressionsState =3D NIL; - indexInfo->ii_PredicateState =3D NULL; - indexInfo->ii_ExclusionOps =3D NULL; - indexInfo->ii_ExclusionProcs =3D NULL; - indexInfo->ii_ExclusionStrats =3D NULL; - indexInfo->ii_Am =3D accessMethodId; - indexInfo->ii_AmCache =3D NULL; - indexInfo->ii_Context =3D CurrentMemoryContext; + indexInfo =3D makeIndexInfo(numberOfAttributes, numberOfAttributes, + accessMethodId, NIL, NIL, false, false, false); typeObjectId =3D (Oid *) palloc(numberOfAttributes * sizeof(Oid)); collationObjectId =3D (Oid *) palloc(numberOfAttributes * sizeof(Oid)); classObjectId =3D (Oid *) palloc(numberOfAttributes * sizeof(Oid)); @@ -780,27 +770,17 @@ DefineIndex(Oid relationId, =20 /* * Prepare arguments for index_create, primarily an IndexInfo structure. - * Note that ii_Predicate must be in implicit-AND format. + * Note that predicates must be in implicit-AND format. In a concurrent + * build, mark it not-ready-for-inserts. */ - indexInfo =3D makeNode(IndexInfo); - indexInfo->ii_NumIndexAttrs =3D numberOfAttributes; - indexInfo->ii_NumIndexKeyAttrs =3D numberOfKeyAttributes; - indexInfo->ii_Expressions =3D NIL; /* for now */ - indexInfo->ii_ExpressionsState =3D NIL; - indexInfo->ii_Predicate =3D make_ands_implicit((Expr *) stmt->whereClause= ); - indexInfo->ii_PredicateState =3D NULL; - indexInfo->ii_ExclusionOps =3D NULL; - indexInfo->ii_ExclusionProcs =3D NULL; - indexInfo->ii_ExclusionStrats =3D NULL; - indexInfo->ii_Unique =3D stmt->unique; - /* In a concurrent build, mark it not-ready-for-inserts */ - indexInfo->ii_ReadyForInserts =3D !stmt->concurrent; - indexInfo->ii_Concurrent =3D stmt->concurrent; - indexInfo->ii_BrokenHotChain =3D false; - indexInfo->ii_ParallelWorkers =3D 0; - indexInfo->ii_Am =3D accessMethodId; - indexInfo->ii_AmCache =3D NULL; - indexInfo->ii_Context =3D CurrentMemoryContext; + indexInfo =3D makeIndexInfo(numberOfAttributes, + numberOfKeyAttributes, + accessMethodId, + NIL, /* expressions, NIL for now */ + make_ands_implicit((Expr *) stmt->whereClause), + stmt->unique, + !stmt->concurrent, + stmt->concurrent); =20 typeObjectId =3D (Oid *) palloc(numberOfAttributes * sizeof(Oid)); collationObjectId =3D (Oid *) palloc(numberOfAttributes * sizeof(Oid)); diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c index 7085ed2c4c..5c11b5472e 100644 --- a/src/backend/nodes/makefuncs.c +++ b/src/backend/nodes/makefuncs.c @@ -1,8 +1,8 @@ /*------------------------------------------------------------------------- * * makefuncs.c - * creator functions for primitive nodes. The functions here are for - * the most frequently created nodes. + * creator functions for various nodes. The functions here are for the + * most frequently created nodes. * * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California @@ -733,6 +733,54 @@ make_ands_implicit(Expr *clause) return list_make1(clause); } =20 +/* + * makeIndexInfo + * create an IndexInfo node + */ +IndexInfo * +makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, List *expressions, + List *predicates, bool unique, bool isready, bool concurrent) +{ + IndexInfo *n =3D makeNode(IndexInfo); + + n->ii_NumIndexAttrs =3D numattrs; + n->ii_NumIndexKeyAttrs =3D numkeyattrs; + Assert(n->ii_NumIndexKeyAttrs !=3D 0); + Assert(n->ii_NumIndexKeyAttrs <=3D n->ii_NumIndexAttrs); + n->ii_Unique =3D unique; + n->ii_ReadyForInserts =3D isready; + n->ii_Concurrent =3D concurrent; + + /* expressions */ + n->ii_Expressions =3D expressions; + n->ii_ExpressionsState =3D NIL; + + /* predicates */ + n->ii_Predicate =3D predicates; + n->ii_PredicateState =3D NULL; + + /* exclusion constraints */ + n->ii_ExclusionOps =3D NULL; + n->ii_ExclusionProcs =3D NULL; + n->ii_ExclusionStrats =3D NULL; + + /* speculative inserts */ + n->ii_UniqueOps =3D NULL; + n->ii_UniqueProcs =3D NULL; + n->ii_UniqueStrats =3D NULL; + + /* initialize index-build state to default */ + n->ii_BrokenHotChain =3D false; + n->ii_ParallelWorkers =3D 0; + + /* set up for possible use by index AM */ + n->ii_Am =3D amoid; + n->ii_AmCache =3D NULL; + n->ii_Context =3D CurrentMemoryContext; + + return n; +} + /* * makeGroupingSet * diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index ad7b41d4aa..232bee21c1 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------- * * makefuncs.h - * prototypes for the creator functions (for primitive nodes) + * prototypes for the creator functions for various nodes * * * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group @@ -14,6 +14,7 @@ #ifndef MAKEFUNC_H #define MAKEFUNC_H =20 +#include "nodes/execnodes.h" #include "nodes/parsenodes.h" =20 =20 @@ -92,6 +93,10 @@ extern Node *make_and_qual(Node *qual1, Node *qual2); extern Expr *make_ands_explicit(List *andclauses); extern List *make_ands_implicit(Expr *clause); =20 +extern IndexInfo *makeIndexInfo(int numattrs, int numkeyattrs, Oid amoid, + List *expressions, List *predicates, + bool unique, bool isready, bool concurrent); + extern DefElem *makeDefElem(char *name, Node *arg, int location); extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg, DefElemAction defaction, int location); diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/= expected/create_index.out index 9305649c11..c6d575a2f9 100644 --- a/src/test/regress/expected/create_index.out +++ b/src/test/regress/expected/create_index.out @@ -2170,6 +2170,78 @@ Indexes: "concur_reindex_ind5" UNIQUE, btree (c1) =20 DROP TABLE concur_reindex_tab4; +-- Check handling of indexes with expressions and predicates. The +-- definitions of the rebuilt indexes should match the original +-- definitions. +CREATE TABLE concur_exprs_tab (c1 int , c2 boolean); +INSERT INTO concur_exprs_tab (c1, c2) VALUES (1369652450, FALSE), + (414515746, TRUE), + (897778963, FALSE); +CREATE UNIQUE INDEX concur_exprs_index_expr + ON concur_exprs_tab ((c1::text COLLATE "C")); +CREATE UNIQUE INDEX concur_exprs_index_pred ON concur_exprs_tab (c1) + WHERE (c1::text > 500000000::text COLLATE "C"); +CREATE UNIQUE INDEX concur_exprs_index_pred_2 + ON concur_exprs_tab ((1 / c1)) + WHERE ('-H') >=3D (c2::TEXT) COLLATE "C"; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); + pg_get_indexdef = =20 +--------------------------------------------------------------------------= ------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_expr ON public.concur_exprs_tab US= ING btree (((c1)::text) COLLATE "C") +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); + pg_get_inde= xdef =20 +--------------------------------------------------------------------------= -------------------------------------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_pred ON public.concur_exprs_tab US= ING btree (c1) WHERE ((c1)::text > ((500000000)::text COLLATE "C")) +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); + pg_get_in= dexdef =20 +--------------------------------------------------------------------------= ------------------------------------------------------------------------ + CREATE UNIQUE INDEX concur_exprs_index_pred_2 ON public.concur_exprs_tab = USING btree (((1 / c1))) WHERE ('-H'::text >=3D ((c2)::text COLLATE "C")) +(1 row) + +REINDEX TABLE CONCURRENTLY concur_exprs_tab; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); + pg_get_indexdef = =20 +--------------------------------------------------------------------------= ------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_expr ON public.concur_exprs_tab US= ING btree (((c1)::text) COLLATE "C") +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); + pg_get_inde= xdef =20 +--------------------------------------------------------------------------= -------------------------------------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_pred ON public.concur_exprs_tab US= ING btree (c1) WHERE ((c1)::text > ((500000000)::text COLLATE "C")) +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); + pg_get_in= dexdef =20 +--------------------------------------------------------------------------= ------------------------------------------------------------------------ + CREATE UNIQUE INDEX concur_exprs_index_pred_2 ON public.concur_exprs_tab = USING btree (((1 / c1))) WHERE ('-H'::text >=3D ((c2)::text COLLATE "C")) +(1 row) + +-- ALTER TABLE recreates the indexes, which should keep their collations. +ALTER TABLE concur_exprs_tab ALTER c2 TYPE TEXT; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); + pg_get_indexdef = =20 +--------------------------------------------------------------------------= ------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_expr ON public.concur_exprs_tab US= ING btree (((c1)::text) COLLATE "C") +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); + pg_get_inde= xdef =20 +--------------------------------------------------------------------------= -------------------------------------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_pred ON public.concur_exprs_tab US= ING btree (c1) WHERE ((c1)::text > ((500000000)::text COLLATE "C")) +(1 row) + +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); + pg_get_indexd= ef =20 +--------------------------------------------------------------------------= ---------------------------------------------------------------- + CREATE UNIQUE INDEX concur_exprs_index_pred_2 ON public.concur_exprs_tab = USING btree (((1 / c1))) WHERE ('-H'::text >=3D (c2 COLLATE "C")) +(1 row) + +DROP TABLE concur_exprs_tab; -- -- REINDEX SCHEMA -- diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/c= reate_index.sql index cd46f071bd..f96bebf410 100644 --- a/src/test/regress/sql/create_index.sql +++ b/src/test/regress/sql/create_index.sql @@ -872,6 +872,34 @@ REINDEX INDEX CONCURRENTLY concur_reindex_ind5; \d concur_reindex_tab4 DROP TABLE concur_reindex_tab4; =20 +-- Check handling of indexes with expressions and predicates. The +-- definitions of the rebuilt indexes should match the original +-- definitions. +CREATE TABLE concur_exprs_tab (c1 int , c2 boolean); +INSERT INTO concur_exprs_tab (c1, c2) VALUES (1369652450, FALSE), + (414515746, TRUE), + (897778963, FALSE); +CREATE UNIQUE INDEX concur_exprs_index_expr + ON concur_exprs_tab ((c1::text COLLATE "C")); +CREATE UNIQUE INDEX concur_exprs_index_pred ON concur_exprs_tab (c1) + WHERE (c1::text > 500000000::text COLLATE "C"); +CREATE UNIQUE INDEX concur_exprs_index_pred_2 + ON concur_exprs_tab ((1 / c1)) + WHERE ('-H') >=3D (c2::TEXT) COLLATE "C"; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +REINDEX TABLE CONCURRENTLY concur_exprs_tab; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +-- ALTER TABLE recreates the indexes, which should keep their collations. +ALTER TABLE concur_exprs_tab ALTER c2 TYPE TEXT; +SELECT pg_get_indexdef('concur_exprs_index_expr'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred'::regclass); +SELECT pg_get_indexdef('concur_exprs_index_pred_2'::regclass); +DROP TABLE concur_exprs_tab; + -- -- REINDEX SCHEMA -- --NU0Ex4SbNnrxsi6C-- --M38YqGLZlgb6RLPS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl06SoUACgkQnvQgOdby QH0M0RAApZsFwwlw6LcasW2Psms1Gin8R8SJWM7SUj1j7D/Ew849KlbFPQxxsMBm gGaOrN9mI4mSkgxE+VDghUcvWgyrW0sl51HPf+eAMxPrbQgR99GCDoQ24Rl+sizQ Bfv/mRIVvrlKWmNy23I5uxV2ipBzaOwSeaUzfdWkYhLupbbJSvfTJRdji+HSRp6M xVvtD9g7AtmwXo9nPq84ihsfxi2S7AO9l1k5DTM4u9aqSkslW8FIQZlI3EkKK5Lt ljtHZ4z6qkJ4jqbjAbuSngfs2/mcRcjX+58H3h3nrPmPPpkUzooMWlCH2IzDlJkm 6brk5I+INZcQl075Dy1dvD1AbvOhiGBPAIuEJ1AD3rg9FjrWMVtGu+7v/SKw4FRJ bJljqyz2ZL5NrGdLueXxlGi2DBpzPQGcgbLK4gPSdyoRsnpge7e9+EOODMyy0Is3 x0Squ9cVflOJCwkzI0Xi4e3X2lM2GHo1qqil8Kx619uPcFGLxj0cxmAGaOhukBoc QjLJ/iN40pah35IulgJex0qcpDdmkN1ZzFIKuInqYTKfRZri6myE1sSpyppXHZul SVqL9H0ECwev/OQ7j5hcJE/znye1F/4MoLANlnwovo6W7Y3ZyINPpvvn8LSjT8+4 xIpYz6eqpAx0X5SLgIVeLYvJ0wzcA98jForQwgfl2MNxBcL/EMQ= =T2Wt -----END PGP SIGNATURE----- --M38YqGLZlgb6RLPS--