pgsql: Use -Wno-format-truncation and -Wno-stringop-truncation, if avai

2018-06-16 Thread Tom Lane
Use -Wno-format-truncation and -Wno-stringop-truncation, if available. gcc 8 has started emitting some warnings that are largely useless for our purposes, particularly since they complain about code following the project-standard coding convention that path names are assumed to be shorter than MAX

pgsql: Use -Wno-format-truncation and -Wno-stringop-truncation, if avai

2018-06-16 Thread Tom Lane
Use -Wno-format-truncation and -Wno-stringop-truncation, if available. gcc 8 has started emitting some warnings that are largely useless for our purposes, particularly since they complain about code following the project-standard coding convention that path names are assumed to be shorter than MAX

pgsql: Suppress -Wshift-negative-value warnings.

2018-06-17 Thread Tom Lane
Suppress -Wshift-negative-value warnings. Clean up four places that result in compiler warnings when using recent gcc with this warning class enabled (as seen on buildfarm members calliphoridae, skink, and others). In all these places, this is purely cosmetic, because the shift distance could not

pgsql: Consider syntactic form when disambiguating function vs column r

2018-06-18 Thread Tom Lane
Consider syntactic form when disambiguating function vs column reference. Postgres has traditionally considered the syntactic forms f(x) and x.f to be equivalent, allowing tricks such as writing a function and then using it as though it were a computed-on-demand column. However, our behavior when

pgsql: Remove obsolete prohibition on function name matching a column n

2018-06-18 Thread Tom Lane
Remove obsolete prohibition on function name matching a column name. ProcedureCreate formerly threw an error if the function to be created has one argument of composite type and the function name matches some column of the composite type. This was a (very non-bulletproof) defense against creating

pgsql: Fix excessive enreferencing in jsonb-to-plperl transform.

2018-06-18 Thread Tom Lane
Fix excessive enreferencing in jsonb-to-plperl transform. We want, say, 2 to be transformed as 2, not \\2 which is what the original coding produced. Perl's standard seems to be to add an RV wrapper only for hash and array SVs, so do it like that. This was missed originally because the test case

pgsql: Avoid platform-dependent output from Data::Dumper.

2018-06-18 Thread Tom Lane
Avoid platform-dependent output from Data::Dumper. Per buildfarm, the output from Data::Dumper for an IEEE infinity is platform-dependent (e.g. "inf" vs "Inf"). Just skip that one test case in the plperlu test; testing it on the plperl side is coverage enough. Fixes issue in commit 1731e3741. B

pgsql: Allow plperl_sv_to_datum to look through scalar refs.

2018-06-18 Thread Tom Lane
Allow plperl_sv_to_datum to look through scalar refs. There seems little reason for the policy of throwing error if we find a ref to something other than a hash or array. Recursively look through the ref, instead. This makes the behavior in non-transform cases comparable to what was already ins

pgsql: Fix contrib/hstore_plperl to look through scalar refs.

2018-06-18 Thread Tom Lane
Fix contrib/hstore_plperl to look through scalar refs. Bring this transform function into sync with the policy established by commit 3a382983d. Also, fix it to make sure that what it drills down to is indeed a hash, and not some other kind of Perl SV. Previously, the test cases added here provok

pgsql: Fix contrib/hstore_plperl to look through scalar refs.

2018-06-18 Thread Tom Lane
Fix contrib/hstore_plperl to look through scalar refs. Bring this transform function into sync with the policy established by commit 3a382983d. Also, fix it to make sure that what it drills down to is indeed a hash, and not some other kind of Perl SV. Previously, the test cases added here provok

pgsql: Fix contrib/hstore_plperl to look through scalar refs.

2018-06-18 Thread Tom Lane
Fix contrib/hstore_plperl to look through scalar refs. Bring this transform function into sync with the policy established by commit 3a382983d. Also, fix it to make sure that what it drills down to is indeed a hash, and not some other kind of Perl SV. Previously, the test cases added here provok

pgsql: Fix contrib/hstore_plperl to look through scalar refs.

2018-06-18 Thread Tom Lane
Fix contrib/hstore_plperl to look through scalar refs. Bring this transform function into sync with the policy established by commit 3a382983d. Also, fix it to make sure that what it drills down to is indeed a hash, and not some other kind of Perl SV. Previously, the test cases added here provok

pgsql: Fix jsonb_plperl to convert Perl UV values correctly.

2018-06-18 Thread Tom Lane
Fix jsonb_plperl to convert Perl UV values correctly. Values greater than IV_MAX were incorrectly converted to SQL, for instance ~0 would become -1 rather than 18446744073709551615 (on a 64-bit machine). Dagfinn Ilmari Mannsåker, adjusted a bit by me Discussion: https://postgr.es/m/d8jtvskjzzs..

Re: pgsql: Fix for globals.c- c.h must come first

2018-06-19 Thread Tom Lane
But I'm not sure how we'd get full coverage. The case presumably would only occur for off-the-beaten-path headers (this particular mistake was ), and there are lots of those. regards, tom lane

Re: pgsql: Fix for globals.c- c.h must come first

2018-06-19 Thread Tom Lane
Andres Freund writes: > On 2018-06-19 14:09:15 -0400, Tom Lane wrote: >> Hm. You could imagine adding something like >> >> #ifdef some-relevant-macro >> #error include ordering problem, c.h must come before system headers >> #endif >> >> near th

Re: pgsql: Fix for globals.c- c.h must come first

2018-06-19 Thread Tom Lane
some files that only get compiled for Windows. But even two separate tests of this sort seems reasonable. regards, tom lane

Re: pgsql: Fix for globals.c- c.h must come first

2018-06-19 Thread Tom Lane
aiting for v12 seems fine. regards, tom lane

pgsql: Clarify the README files for the various separate TAP-based test

2018-06-19 Thread Tom Lane
Clarify the README files for the various separate TAP-based test suites. Explain the difference between "make check" and "make installcheck". Mention the need for --enable-tap-tests (only some of these did so before). Standardize their wording about how to run the tests. Branch -- master De

pgsql: Fix mishandling of sortgroupref labels while splitting SRF targe

2018-06-21 Thread Tom Lane
Fix mishandling of sortgroupref labels while splitting SRF targetlists. split_pathtarget_at_srfs() neglected to worry about sortgroupref labels in the intermediate PathTargets it constructs. I think we'd supposed that their labeling didn't matter, but it does at least for the case that GroupAggre

pgsql: Fix mishandling of sortgroupref labels while splitting SRF targe

2018-06-21 Thread Tom Lane
Fix mishandling of sortgroupref labels while splitting SRF targetlists. split_pathtarget_at_srfs() neglected to worry about sortgroupref labels in the intermediate PathTargets it constructs. I think we'd supposed that their labeling didn't matter, but it does at least for the case that GroupAggre

pgsql: Improve requirements documentation for ldap test suite.

2018-06-21 Thread Tom Lane
Improve requirements documentation for ldap test suite. Text by me; data contributed by me, Thomas Munro, Michael Paquier. Discussion: https://postgr.es/m/20180521013425.ga4...@paquier.xyz Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/425b4c082c82672c646ed8bc9e14

pgsql: Fix partial aggregation for variance(int4) and related aggregate

2018-06-21 Thread Tom Lane
Fix partial aggregation for variance(int4) and related aggregates. A typo in numeric_poly_combine caused bogus results for queries using it, but of course would only manifest if parallel aggregation is performed. Reported by Rajkumar Raghuwanshi. David Rowley did the diagnosis and the fix; I edi

pgsql: Fix partial aggregation for variance(int4) and related aggregate

2018-06-21 Thread Tom Lane
Fix partial aggregation for variance(int4) and related aggregates. A typo in numeric_poly_combine caused bogus results for queries using it, but of course would only manifest if parallel aggregation is performed. Reported by Rajkumar Raghuwanshi. David Rowley did the diagnosis and the fix; I edi

Re: pgsql: Allow for pg_upgrade of attributes with missing values

2018-06-22 Thread Tom Lane
Andrew Dunstan writes: > Allow for pg_upgrade of attributes with missing values Buildfarm results suggest that binary_upgrade_set_missing_value should have been marked proparallel => 'u'. regards, tom lane

Re: pgsql: Increase upper limit for vacuum_cleanup_index_scale_factor

2018-06-26 Thread Tom Lane
quate justification. Why not just set it to 1e9 or 1e10 or some such? regards, tom lane

Re: pgsql: Fix "base" snapshot handling in logical decoding

2018-06-28 Thread Tom Lane
hanges('isolation_s lot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); data which looks like it might just be a timeout problem. regards, tom lane

Re: pgsql: Fix crash when ALTER TABLE recreates indexes on partitions

2018-06-29 Thread Tom Lane
is particular patch could have caused a problem, and skink's report is pretty useless because it's providing only a numeric stack trace. Thoughts? regards, tom lane

Re: pgsql: Clarify use of temporary tables within partition trees

2018-07-03 Thread Tom Lane
them is privilege-checked. Be careful that you don't end up with zero privilege checks on the partition root :-( regards, tom lane

Re: pgsql: Add wait event for fsync of WAL segments

2018-07-09 Thread Tom Lane
tats.html#WAIT-EVENT-TABLE. >> Trivial patch attached. > Thanks, Julien! Fixed. Indeed the table format was weird.. Hm, do we need that "morerows" thing at all? It seems impossible that we'll remember to keep it up to date in future. How do you even check that it's right now? regards, tom lane

pgsql: Fix yet more problems with incorrectly-constructed zero-length a

2018-07-09 Thread Tom Lane
Fix yet more problems with incorrectly-constructed zero-length arrays. Commit 716ea626a attempted to fix the problem of building 1-D zero-size arrays once and for all. But it turns out that contrib/intarray has some code that doesn't use construct_array() but just builds arrays by hand, so it did

pgsql: Fix yet more problems with incorrectly-constructed zero-length a

2018-07-09 Thread Tom Lane
Fix yet more problems with incorrectly-constructed zero-length arrays. Commit 716ea626a attempted to fix the problem of building 1-D zero-size arrays once and for all. But it turns out that contrib/intarray has some code that doesn't use construct_array() but just builds arrays by hand, so it did

pgsql: Prevent accidental linking of system-supplied copies of libpq.so

2018-07-09 Thread Tom Lane
Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the for

pgsql: Prevent accidental linking of system-supplied copies of libpq.so

2018-07-09 Thread Tom Lane
Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the for

pgsql: Prevent accidental linking of system-supplied copies of libpq.so

2018-07-09 Thread Tom Lane
Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the for

pgsql: Prevent accidental linking of system-supplied copies of libpq.so

2018-07-09 Thread Tom Lane
Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the for

pgsql: Prevent accidental linking of system-supplied copies of libpq.so

2018-07-09 Thread Tom Lane
Prevent accidental linking of system-supplied copies of libpq.so etc. Back-patch commit dddfc4cb2, which broke LDFLAGS and related Makefile variables into two parts, one for within-build-tree library references and one for external libraries, to ensure that the order of -L flags has all of the for

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

pgsql: Avoid emitting a bogus WAL record when recycling an all-zero btr

2018-07-09 Thread Tom Lane
Avoid emitting a bogus WAL record when recycling an all-zero btree page. Commit fafa374f2 caused _bt_getbuf() to possibly emit a WAL record for a page that it was about to recycle. However, it failed to distinguish all-zero pages from dead pages, which is important because only the latter have va

Re: pgsql: Fix wrong file path in header comment

2018-07-11 Thread Tom Lane
regards, tom lane

pgsql: Fix bugs with degenerate window ORDER BY clauses in GROUPS/RANGE

2018-07-11 Thread Tom Lane
t anyone ever will.) With these changes, the WindowAggPath.winpathkeys field is not used for anything anymore, so remove it. The test cases added here are not actually very interesting given the removal of the redundant-column-removal logic, but they would represent important corner cases if anyone ever tries to

pgsql: Fix bugs with degenerate window ORDER BY clauses in GROUPS/RANGE

2018-07-11 Thread Tom Lane
t anyone ever will.) With these changes, the WindowAggPath.winpathkeys field is not used for anything anymore, so remove it. The test cases added here are not actually very interesting given the removal of the redundant-column-removal logic, but they would represent important corner cases if anyone ever tries to

pgsql: Fix create_scan_plan's handling of sortgrouprefs for physical tl

2018-07-11 Thread Tom Lane
Fix create_scan_plan's handling of sortgrouprefs for physical tlists. We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST was specified, because only in that case has use_physical_tlist checked that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY expression n

pgsql: Fix create_scan_plan's handling of sortgrouprefs for physical tl

2018-07-11 Thread Tom Lane
Fix create_scan_plan's handling of sortgrouprefs for physical tlists. We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST was specified, because only in that case has use_physical_tlist checked that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY expression n

pgsql: Fix create_scan_plan's handling of sortgrouprefs for physical tl

2018-07-11 Thread Tom Lane
Fix create_scan_plan's handling of sortgrouprefs for physical tlists. We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST was specified, because only in that case has use_physical_tlist checked that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY expression n

pgsql: Fix create_scan_plan's handling of sortgrouprefs for physical tl

2018-07-11 Thread Tom Lane
Fix create_scan_plan's handling of sortgrouprefs for physical tlists. We should only run apply_pathtarget_labeling_to_tlist if CP_LABEL_TLIST was specified, because only in that case has use_physical_tlist checked that the labeling will succeed; otherwise we may get an "ORDER/GROUP BY expression n

pgsql: Mark built-in btree comparison functions as leakproof where it's

2018-07-11 Thread Tom Lane
Mark built-in btree comparison functions as leakproof where it's safe. Generally, if the comparison operators for a datatype or pair of datatypes are leakproof, the corresponding btree comparison support function can be considered so as well. But we had not originally worried about marking suppor

pgsql: Doc: clarify release note text about v11's new window function f

2018-07-12 Thread Tom Lane
Doc: clarify release note text about v11's new window function features. Jonathan S. Katz Discussion: https://postgr.es/m/30468663-e67d-4753-8269-7e6a4001a...@excoventures.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/11a3aeeb5e174a3681f674e7e5ec9bbbc6430394

pgsql: Doc: update documentation for requirement of ORDER BY in GROUPS

2018-07-12 Thread Tom Lane
Doc: update documentation for requirement of ORDER BY in GROUPS mode. Commit ff4f88916 adjusted the code to enforce the SQL spec's requirement that a window using GROUPS mode must have an ORDER BY clause. But I missed that the documentation explicitly said you didn't have to have one. Also minor

pgsql: Doc: update documentation for requirement of ORDER BY in GROUPS

2018-07-12 Thread Tom Lane
Doc: update documentation for requirement of ORDER BY in GROUPS mode. Commit ff4f88916 adjusted the code to enforce the SQL spec's requirement that a window using GROUPS mode must have an ORDER BY clause. But I missed that the documentation explicitly said you didn't have to have one. Also minor

pgsql: Doc: clarify release note text about v11's new window function f

2018-07-12 Thread Tom Lane
Doc: clarify release note text about v11's new window function features. Jonathan S. Katz Discussion: https://postgr.es/m/30468663-e67d-4753-8269-7e6a4001a...@excoventures.com Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/510421c45fb41869969a708a8c03c1279

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

pgsql: Doc: minor improvement in pl/pgsql FETCH/MOVE documentation.

2018-07-12 Thread Tom Lane
Doc: minor improvement in pl/pgsql FETCH/MOVE documentation. Explain that you can use any integer expression for the "count" in pl/pgsql's versions of FETCH/MOVE, unlike the SQL versions which only allow a constant. Remove the duplicate version of this para under MOVE. I don't see a good reason

Re: pgsql: Allow using the updated tuple while moving it to a different par

2018-07-12 Thread Tom Lane
INTO tab_int VALUES (11000);]); replay_check(); so I'm thinking that what we're seeing is an effect of the second standby sometimes being too slow to turn on hot_standby_feedback. We could maybe hack around that with a short "sleep" in this script, but a less cruddy solution would be to change PostgresNode::reload so that it somehow waits for the server to process the reload signal. regards, tom lane

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix inadequate buffer locking in FSM and VM page re-initializati

2018-07-13 Thread Tom Lane
Fix inadequate buffer locking in FSM and VM page re-initialization. When reading an existing FSM or VM page that was found to be corrupt by the buffer manager, the code applied PageInit() to reinitialize the page, but did so without any locking. There is thus a hazard that two backends might conc

pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records

2018-07-13 Thread Tom Lane
Fix crash in json{b}_populate_recordset() and json{b}_to_recordset(). As of commit 37a795a60, populate_recordset_worker() tried to pass back (as rsi.setDesc) a tupdesc that it also had cached in its fn_extra. But the core executor would free the passed-back tupdesc, risking a crash if the function

pgsql: Fix crash in json{b}_populate_recordset() and json{b}_to_records

2018-07-13 Thread Tom Lane
Fix crash in json{b}_populate_recordset() and json{b}_to_recordset(). As of commit 37a795a60, populate_recordset_worker() tried to pass back (as rsi.setDesc) a tupdesc that it also had cached in its fn_extra. But the core executor would free the passed-back tupdesc, risking a crash if the function

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix crash in contrib/ltree's lca() function for empty input arra

2018-07-13 Thread Tom Lane
Fix crash in contrib/ltree's lca() function for empty input array. lca_inner() wasn't prepared for the possibility of getting no inputs. Fix that, and make some cosmetic improvements to the code while at it. Also, I thought the documentation of this function as returning the "longest common prefi

pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi

2018-07-14 Thread Tom Lane
Fix hashjoin costing mistake introduced with inner_unique optimization. In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases to follow a code path previously used only for SEMI/ANTI joins; but it neglected to fix an if-test within that path that assumed SEMI and ANTI were the only

pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi

2018-07-14 Thread Tom Lane
Fix hashjoin costing mistake introduced with inner_unique optimization. In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases to follow a code path previously used only for SEMI/ANTI joins; but it neglected to fix an if-test within that path that assumed SEMI and ANTI were the only

pgsql: Fix hashjoin costing mistake introduced with inner_unique optimi

2018-07-14 Thread Tom Lane
Fix hashjoin costing mistake introduced with inner_unique optimization. In final_cost_hashjoin(), commit 9c7f5229a allowed inner_unique cases to follow a code path previously used only for SEMI/ANTI joins; but it neglected to fix an if-test within that path that assumed SEMI and ANTI were the only

Re: pgsql: Rework error messages around file handling

2018-07-17 Thread Tom Lane
Michael Paquier writes: > Rework error messages around file handling longfin thinks you missed at least one cast ... regards, tom lane

Re: pgsql: Rework error messages around file handling

2018-07-17 Thread Tom Lane
Michael Paquier writes: > On Tue, Jul 17, 2018 at 07:23:04PM -0400, Tom Lane wrote: >> longfin thinks you missed at least one cast ... > Hm, I checked that. Just casting to (Size) should do it. Sounds right to me. regards, tom lane

Re: pgsql: Rework error messages around file handling

2018-07-17 Thread Tom Lane
in walsender.c. No objection to the other two though, they might be relevant on other platforms. regards, tom lane

pgsql: Use a ResourceOwner to track buffer pins in all cases.

2018-07-18 Thread Tom Lane
Use a ResourceOwner to track buffer pins in all cases. Historically, we've allowed auxiliary processes to take buffer pins without tracking them in a ResourceOwner. However, that creates problems for error recovery. In particular, we've seen multiple reports of assertion crashes in the startup p

pgsql: Drop the rule against included index columns duplicating key col

2018-07-18 Thread Tom Lane
Drop the rule against included index columns duplicating key columns. The initial version of the included-index-column feature stated that included columns couldn't be the same as any key column of the index. While it'd be pretty silly to do that, since the included column would be entirely redund

pgsql: Drop the rule against included index columns duplicating key col

2018-07-18 Thread Tom Lane
Drop the rule against included index columns duplicating key columns. The initial version of the included-index-column feature stated that included columns couldn't be the same as any key column of the index. While it'd be pretty silly to do that, since the included column would be entirely redund

pgsql: Remove race-prone hot_standby_feedback test cases in 001_stream_

2018-07-18 Thread Tom Lane
Remove race-prone hot_standby_feedback test cases in 001_stream_rep.pl. This script supposed that if it turned hot_standby_feedback on and then shut down the standby server, at least one feedback message would be guaranteed to be sent before the standby stops. But there is no such guarantee, if t

pgsql: Remove race-prone hot_standby_feedback test cases in 001_stream_

2018-07-18 Thread Tom Lane
Remove race-prone hot_standby_feedback test cases in 001_stream_rep.pl. This script supposed that if it turned hot_standby_feedback on and then shut down the standby server, at least one feedback message would be guaranteed to be sent before the standby stops. But there is no such guarantee, if t

pgsql: Remove race-prone hot_standby_feedback test cases in 001_stream_

2018-07-18 Thread Tom Lane
Remove race-prone hot_standby_feedback test cases in 001_stream_rep.pl. This script supposed that if it turned hot_standby_feedback on and then shut down the standby server, at least one feedback message would be guaranteed to be sent before the standby stops. But there is no such guarantee, if t

pgsql: Fix pg_get_indexdef()'s behavior for included index columns.

2018-07-19 Thread Tom Lane
Fix pg_get_indexdef()'s behavior for included index columns. The multi-argument form of pg_get_indexdef() failed to print anything when asked to print a single index column that is an included column rather than a key column. This seems an unintentional result of someone having tried to take a sh

pgsql: Improve psql's \d command to show whether index columns are key

2018-07-19 Thread Tom Lane
Improve psql's \d command to show whether index columns are key columns. This is essential information when looking at an index that has "included" columns. Per discussion, follow the style used in \dC and some other places: column header is "Key?" and values are "yes" or "no" (all translatable).

pgsql: Fix pg_get_indexdef()'s behavior for included index columns.

2018-07-19 Thread Tom Lane
Fix pg_get_indexdef()'s behavior for included index columns. The multi-argument form of pg_get_indexdef() failed to print anything when asked to print a single index column that is an included column rather than a key column. This seems an unintentional result of someone having tried to take a sh

pgsql: Improve psql's \d command to show whether index columns are key

2018-07-19 Thread Tom Lane
Improve psql's \d command to show whether index columns are key columns. This is essential information when looking at an index that has "included" columns. Per discussion, follow the style used in \dC and some other places: column header is "Key?" and values are "yes" or "no" (all translatable).

pgsql: Remove undocumented restriction against duplicate partition key

2018-07-19 Thread Tom Lane
Remove undocumented restriction against duplicate partition key columns. transformPartitionSpec rejected duplicate simple partition columns (e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression columns, resulting in inconsistent behavior. Worse, cases like "PARTITION BY RANGE (x,

pgsql: Remove undocumented restriction against duplicate partition key

2018-07-19 Thread Tom Lane
Remove undocumented restriction against duplicate partition key columns. transformPartitionSpec rejected duplicate simple partition columns (e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression columns, resulting in inconsistent behavior. Worse, cases like "PARTITION BY RANGE (x,

pgsql: Remove undocumented restriction against duplicate partition key

2018-07-19 Thread Tom Lane
Remove undocumented restriction against duplicate partition key columns. transformPartitionSpec rejected duplicate simple partition columns (e.g., "PARTITION BY RANGE (x,x)") but paid no attention to expression columns, resulting in inconsistent behavior. Worse, cases like "PARTITION BY RANGE (x,

pgsql: Avoid unportable shell syntax in pg_upgrade's test script.

2018-07-20 Thread Tom Lane
Avoid unportable shell syntax in pg_upgrade's test script. Most of test.sh uses traditional backtick syntax for command substitution, but commit da9b580d8 introduced two uses of $(...) syntax, which is not recognized by very old shells. Bring those into line with the rest. Victor Wagner Discuss

pgsql: Avoid unportable shell syntax in pg_upgrade's test script.

2018-07-20 Thread Tom Lane
Avoid unportable shell syntax in pg_upgrade's test script. Most of test.sh uses traditional backtick syntax for command substitution, but commit da9b580d8 introduced two uses of $(...) syntax, which is not recognized by very old shells. Bring those into line with the rest. Victor Wagner Discuss

<    5   6   7   8   9   10   11   12   13   14   >