pgsql: Allow generalized expression syntax for partition bounds

2019-01-25 Thread Peter Eisentraut
Allow generalized expression syntax for partition bounds Previously, only literals were allowed. This change allows general expressions, including functions calls, which are evaluated at the time the DDL command is executed. Besides offering some more functionality, it simplifies the parser stru

pgsql: Fix comments that claimed that mblen() only looks at first byte.

2019-01-25 Thread Heikki Linnakangas
Fix comments that claimed that mblen() only looks at first byte. GB18030's mblen() function looks at the first and the second byte of the multibyte character, to determine its length. copy.c had made the assumption that mblen() only looks at the first byte, but it turns out to work out fine, becau

pgsql: Use single-byte Boyer-Moore-Horspool search even with multibyte

2019-01-25 Thread Heikki Linnakangas
Use single-byte Boyer-Moore-Horspool search even with multibyte encodings. The old implementation first converted the input strings to arrays of wchars, and performed the conversion on those. However, the conversion is expensive, and for a large input string, consumes a lot of memory. Allocating t

pgsql: Fix possibly-uninitialized-variable warning from commit 9556aa01

2019-01-25 Thread Tom Lane
Fix possibly-uninitialized-variable warning from commit 9556aa01c. Heikki's compiler doesn't complain about end_ptr, apparently, but mine does. In passing, I failed to resist the temptation to remove the no-longer-used fldnum variable, and relocate chunk_len's declaration to a narrower scope. Br

pgsql: Teach nulltestsel() that system columns are never NULL.

2019-01-25 Thread Tom Lane
Teach nulltestsel() that system columns are never NULL. While it's perhaps unlikely that users would write an explicit test like "ctid IS NULL", this function is also used in range estimation, and an incorrect answer can throw off the results for tight ranges. Anyway it's not much code so we might

pgsql: Split QTW_EXAMINE_RTES flag into QTW_EXAMINE_RTES_BEFORE/_AFTER.

2019-01-25 Thread Tom Lane
Split QTW_EXAMINE_RTES flag into QTW_EXAMINE_RTES_BEFORE/_AFTER. This change allows callers of query_tree_walker() to choose whether to visit an RTE before or after visiting the contents of the RTE (i.e., prefix or postfix tree order). All existing users of QTW_EXAMINE_RTES want the QTW_EXAMINE_R

pgsql: SQL comment: remove extra word in heading comment

2019-01-25 Thread Bruce Momjian
SQL comment: remove extra word in heading comment Reported-by: Daniel Gustafsson Discussion: https://postgr.es/m/[email protected] Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/df4c9044406f1e907268930dd12ba6

pgsql: Simplify restriction handling of two-phase commit for temporary

2019-01-25 Thread Michael Paquier
Simplify restriction handling of two-phase commit for temporary objects There were two flags used to track the access to temporary tables and to the temporary namespace of a session which are used to restrict PREPARE TRANSACTION, however the first control flag is a concept included in the second.

Re: pgsql: Allow generalized expression syntax for partition bounds

2019-01-25 Thread Michael Paquier
On Fri, Jan 25, 2019 at 10:37:22AM +, Peter Eisentraut wrote: > Allow generalized expression syntax for partition bounds > > Previously, only literals were allowed. This change allows general > expressions, including functions calls, which are evaluated at the > time the DDL command is execut

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

pgsql: Allow UNLISTEN in hot-standby mode.

2019-01-25 Thread Tom Lane
Allow UNLISTEN in hot-standby mode. Since LISTEN is (still) disallowed, UNLISTEN must be a no-op in a hot-standby session, and so there's no harm in allowing it. This change allows client code to not worry about whether it's connected to a primary or standby server when performing session-state-r

Re: pgsql: Allow generalized expression syntax for partition bounds

2019-01-25 Thread Amit Langote
On Sat, Jan 26, 2019 at 11:05 Michael Paquier wrote: > On Fri, Jan 25, 2019 at 10:37:22AM +, Peter Eisentraut wrote: > > Allow generalized expression syntax for partition bounds > > > > Previously, only literals were allowed. This change allows general > > expressions, including functions ca

Re: pgsql: Allow generalized expression syntax for partition bounds

2019-01-25 Thread Michael Paquier
On Sat, Jan 26, 2019 at 11:53:17AM +0900, Amit Langote wrote: > Have sent the patch on the -hackers thread for this patch after Tom > pointed out one of these failures. And I have commented on the patch. I noticed the thread on -hackers after going through the commits. -- Michael signature.asc