pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX

2019-10-28 Thread Michael Paquier
Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY When cancelling REINDEX CONCURRENTLY after swapping the old and new indexes (for example interruption at step 5), the old index remains around and is marked as invalid. The old index should also be manually droppable to

pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX

2019-10-28 Thread Michael Paquier
Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY When cancelling REINDEX CONCURRENTLY after swapping the old and new indexes (for example interruption at step 5), the old index remains around and is marked as invalid. The old index should also be manually droppable to

pgsql: Allow extracting fields from a ROW() expression in more cases.

2019-10-28 Thread Tom Lane
Allow extracting fields from a ROW() expression in more cases. Teach get_expr_result_type() to manufacture a tuple descriptor directly from a RowExpr node. If the RowExpr has type RECORD, this is the only way to get a tupdesc for its result, since even if the rowtype has been blessed, we don't ha

pgsql: On Windows, use COMSPEC to find the location of cmd.exe.

2019-10-28 Thread Tom Lane
On Windows, use COMSPEC to find the location of cmd.exe. Historically, psql consulted COMSPEC to spawn a shell in its \! command, but we just invoked "cmd" when spawning shells in pg_ctl and pg_regress. It seems better to rely on the environment variable, if it's set, in all cases. It's debatable

pgsql: Handle empty-string edge cases correctly in strpos().

2019-10-28 Thread Tom Lane
Handle empty-string edge cases correctly in strpos(). Commit 9556aa01c rearranged the innards of text_position() in a way that would make it not work for empty search strings. Which is fine, because all callers of that code special-case an empty pattern in some way. However, the primary use-case

pgsql: Handle empty-string edge cases correctly in strpos().

2019-10-28 Thread Tom Lane
Handle empty-string edge cases correctly in strpos(). Commit 9556aa01c rearranged the innards of text_position() in a way that would make it not work for empty search strings. Which is fine, because all callers of that code special-case an empty pattern in some way. However, the primary use-case