pgsql: Fix progress reporting of REINDEX CONCURRENTLY

2020-09-28 Thread Michael Paquier
Fix progress reporting of REINDEX CONCURRENTLY This addresses a couple of issues with the so-said subject: - Report the correct parent relation with the index actually being rebuilt or validated. Previously, the command status remained set to the last index created for the progress of the index b

pgsql: Fix progress reporting of REINDEX CONCURRENTLY

2020-09-28 Thread Michael Paquier
Fix progress reporting of REINDEX CONCURRENTLY This addresses a couple of issues with the so-said subject: - Report the correct parent relation with the index actually being rebuilt or validated. Previously, the command status remained set to the last index created for the progress of the index b

pgsql: Fix progress reporting of REINDEX CONCURRENTLY

2020-09-28 Thread Michael Paquier
Fix progress reporting of REINDEX CONCURRENTLY This addresses a couple of issues with the so-said subject: - Report the correct parent relation with the index actually being rebuilt or validated. Previously, the command status remained set to the last index created for the progress of the index b

pgsql: Add for_each_from, to simplify loops starting from non-first lis

2020-09-28 Thread Tom Lane
Add for_each_from, to simplify loops starting from non-first list cells. We have a dozen or so places that need to iterate over all but the first cell of a List. Prior to v13 this was typically written as for_each_cell(lc, lnext(list_head(list))) Commit 1cff1b95a changed these to

pgsql: Add for_each_from, to simplify loops starting from non-first lis

2020-09-28 Thread Tom Lane
Add for_each_from, to simplify loops starting from non-first list cells. We have a dozen or so places that need to iterate over all but the first cell of a List. Prior to v13 this was typically written as for_each_cell(lc, lnext(list_head(list))) Commit 1cff1b95a changed these to

pgsql: Revert "Change SHA2 implementation based on OpenSSL to use EVP d

2020-09-28 Thread Michael Paquier
Revert "Change SHA2 implementation based on OpenSSL to use EVP digest routines" This reverts commit e21cbb4, as the switch to EVP routines requires a more careful design where we would need to have at least our wrapper routines return a status instead of issuing an error by themselves to let the c

pgsql: Stabilize create_table regression test.

2020-09-28 Thread Tom Lane
Stabilize create_table regression test. Adding \d+ to the test in commit 2dfa3fea8 was ill-advised, because the partitions' names are such that their sort order is locale dependent. We could rename them to avoid that, but it doesn't seem worth the trouble; just take \d+ out again. Per buildfarm.

pgsql: Assign collations in partition bound expressions.

2020-09-28 Thread Tom Lane
Assign collations in partition bound expressions. Failure to do this can result in errors during evaluation of the bound expression, as illustrated by the new regression test. Back-patch to v12 where the ability for partition bounds to be expressions was added. Discussion: https://postgr.es/m/C

pgsql: Assign collations in partition bound expressions.

2020-09-28 Thread Tom Lane
Assign collations in partition bound expressions. Failure to do this can result in errors during evaluation of the bound expression, as illustrated by the new regression test. Back-patch to v12 where the ability for partition bounds to be expressions was added. Discussion: https://postgr.es/m/C

pgsql: Assign collations in partition bound expressions.

2020-09-28 Thread Tom Lane
Assign collations in partition bound expressions. Failure to do this can result in errors during evaluation of the bound expression, as illustrated by the new regression test. Back-patch to v12 where the ability for partition bounds to be expressions was added. Discussion: https://postgr.es/m/C

pgsql: Remove complaints about COLLATE clauses in partition bound value

2020-09-28 Thread Tom Lane
Remove complaints about COLLATE clauses in partition bound values. transformPartitionBoundValue went out of its way to do the wrong thing: there is no reason to complain about a non-matching COLLATE clause in a partition boundary expression. We're coercing the bound expression to the target colum

pgsql: Cache the result of converting now() to a struct pg_tm.

2020-09-28 Thread Tom Lane
Cache the result of converting now() to a struct pg_tm. SQL operations such as CURRENT_DATE, CURRENT_TIME, LOCALTIME, and conversion of "now" in a datetime input string have to obtain the transaction start timestamp ("now()") as a broken-down struct pg_tm. This is a remarkably expensive conversion