pgsql: Add copy/equal support for XID lists

2022-07-12 Thread Alvaro Herrera
Add copy/equal support for XID lists Commit f10a025cfe97 added support for List to store Xids, but didn't handle the new type in all cases. Add some obviously necessary pieces. As far as I am aware, this is all dead code as far as core code is concerned, but it seems unacceptable not to have it i

pgsql: Rename some functions to mention Relation instead of RelFileLoca

2022-07-12 Thread Robert Haas
Rename some functions to mention Relation instead of RelFileLocator. This is definitely shorter, and hopefully clearer. Kyotaro Horiguchi, reviewed by Dilip Kumar and by me Discussion: http://postgr.es/m/[email protected] Branch -- master Details

Re: pgsql: Add copy/equal support for XID lists

2022-07-12 Thread Tom Lane
Alvaro Herrera writes: > Add copy/equal support for XID lists What about outfuncs/readfuncs? I see that you fixed _outList, but not its caller outNode: else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList)) _outList(str, obj); and the LEFT_PAREN case in node

pgsql: Add defenses against unexpected changes in the NodeTag enum list

2022-07-12 Thread Tom Lane
Add defenses against unexpected changes in the NodeTag enum list. Having different build systems producing different contents of the NodeTag enum would be catastrophic for extension ABI stability. But that ordering depends on the order in which gen_node_support.pl processes its input files. It se

pgsql: Invent nodetag_only attribute for Nodes.

2022-07-12 Thread Tom Lane
Invent nodetag_only attribute for Nodes. This allows explaining gen_node_support.pl's handling of execnodes.h and some other input files as being a shortcut for explicit marking of all their node declarations as pg_node_attr(nodetag_only). I foresee that someday we might need to be more fine-grain

Re: pgsql: Fix out-of-bounds read in json_lex_string

2022-07-12 Thread Larry Rosenman
On 07/12/2022 1:07 am, Tom Lane wrote: I wrote: John Naylor writes: ld: error: unable to find library -lldap_r Agreed, that looks like some unrelated platform change. Larry? Upon further thought, this looks like fallout from an upgrade to OpenLDAP 2.5, which eliminated libldap_r. That s

Re: pgsql: Add copy/equal support for XID lists

2022-07-12 Thread Alvaro Herrera
On 2022-Jul-12, Tom Lane wrote: > What about outfuncs/readfuncs? I see that you fixed _outList, > but not its caller outNode: > > else if (IsA(obj, List) || IsA(obj, IntList) || IsA(obj, OidList)) > _outList(str, obj); > > and the LEFT_PAREN case in nodeRead() doesn't know w

pgsql: Remove trailing newlines in pg_upgrade's message strings.

2022-07-12 Thread Tom Lane
Remove trailing newlines in pg_upgrade's message strings. pg_upgrade does not use common/logging.c, which is unfortunate but changing it to do so seems like more work than is justified. However, we really need to make it work more like common/logging.c in one respect: the latter expects supplied m

pgsql: Improve error reporting from validate_exec().

2022-07-12 Thread Tom Lane
Improve error reporting from validate_exec(). validate_exec() didn't guarantee to set errno to something appropriate after a failure, leading to callers not being able to print an on-point message. Improve that. Noted by Kyotaro Horiguchi, though this isn't exactly his proposal. Discussion: ht

pgsql: Invent qsort_interruptible().

2022-07-12 Thread Tom Lane
Invent qsort_interruptible(). Justin Pryzby reported that some scenarios could cause gathering of extended statistics to spend many seconds in an un-cancelable qsort() operation. To fix, invent qsort_interruptible(), which is just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS

pgsql: Invent qsort_interruptible().

2022-07-12 Thread Tom Lane
Invent qsort_interruptible(). Justin Pryzby reported that some scenarios could cause gathering of extended statistics to spend many seconds in an un-cancelable qsort() operation. To fix, invent qsort_interruptible(), which is just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS

pgsql: Invent qsort_interruptible().

2022-07-12 Thread Tom Lane
Invent qsort_interruptible(). Justin Pryzby reported that some scenarios could cause gathering of extended statistics to spend many seconds in an un-cancelable qsort() operation. To fix, invent qsort_interruptible(), which is just like qsort_arg() except that it will also do CHECK_FOR_INTERRUPTS

pgsql: Fix ECPG's handling of type names that match SQL keywords.

2022-07-12 Thread Tom Lane
Fix ECPG's handling of type names that match SQL keywords. Previously, ECPG could only cope with variable declarations whose type names either weren't any SQL keyword, or were at least partially reserved. If you tried to use something in the unreserved_keyword category, you got a syntax error. T

pgsql: Tidy up code in get_cheapest_group_keys_order()

2022-07-12 Thread David Rowley
Tidy up code in get_cheapest_group_keys_order() There are a few things that we could do a little better within get_cheapest_group_keys_order(): 1. We should be using list_free() rather than pfree() on a List. 2. We should use for_each_from() instead of manually coding a for loop to skip the firs

pgsql: Tidy up code in get_cheapest_group_keys_order()

2022-07-12 Thread David Rowley
Tidy up code in get_cheapest_group_keys_order() There are a few things that we could do a little better within get_cheapest_group_keys_order(): 1. We should be using list_free() rather than pfree() on a List. 2. We should use for_each_from() instead of manually coding a for loop to skip the firs

Re: pgsql: Clarify that pg_dump takes ACCESS SHARE lock

2022-07-12 Thread John Naylor
On Fri, Jul 1, 2022 at 11:43 AM John Naylor wrote: > > Clarify that pg_dump takes ACCESS SHARE lock It occurred to me that this could easily be backpatched to v15. Since it's not a mistake or omission, there's less of a case to go back further than that. Opinions? -- John Naylor EDB: http://www.

pgsql: createuser: Cleanup and fix internal option ordering

2022-07-12 Thread Michael Paquier
createuser: Cleanup and fix internal option ordering This utility supports 23 options that are not really ordered in the code, making the addition of new things more complicated than necessary. This cleanup is in preparation for a patch to add even more options. Discussion: https://postgr.es/m/69

pgsql: Use list_copy_head() instead of list_truncate(list_copy(...), ..

2022-07-12 Thread David Rowley
Use list_copy_head() instead of list_truncate(list_copy(...), ...) Truncating off the end of a freshly copied List is not a very efficient way of copying the first N elements of a List. In many of the cases that are updated here, the pattern was only being used to remove the final element of a Li

pgsql: createuser: Add support for more clause types through new option

2022-07-12 Thread Michael Paquier
createuser: Add support for more clause types through new options The following options are added to createuser: * --valid-until to generate a VALID UNTIL clause for the role created. * --bypassrls/--no-bypassrls for BYPASSRLS/NOBYPASSRLS. * -m/--member to make the new role a member of an existing

pgsql: Small cleanup of create_list_bounds()

2022-07-12 Thread David Rowley
Small cleanup of create_list_bounds() When checking for interleaved partitions, we mark the partition as interleaved when; 1. we find an earlier partition index when looping over the sorted-by-Datum indexes[] array, or; 2. we find that the NULL partition allows some non-NULL Datum value. In the

pgsql: Small cleanup of create_list_bounds()

2022-07-12 Thread David Rowley
Small cleanup of create_list_bounds() When checking for interleaved partitions, we mark the partition as interleaved when; 1. we find an earlier partition index when looping over the sorted-by-Datum indexes[] array, or; 2. we find that the NULL partition allows some non-NULL Datum value. In the

pgsql: NLS: Put list of available languages into LINGUAS files

2022-07-12 Thread Peter Eisentraut
NLS: Put list of available languages into LINGUAS files This moves the list of available languages from nls.mk into a separate file called po/LINGUAS. Advantages: - It keeps the parts notionally managed by programmers (nls.mk) separate from the parts notionally managed by translators (LINGUAS)