summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-08-08Fix yet another race condition in recovery/t/001_stream_rep.pl.Tom Lane
In commit 5c77690f6, we added polling in front of most of the get_slot_xmins calls in 001_stream_rep.pl, but today's results from buildfarm member nightjar show that at least one more poll loop is needed. Proactively add a poll loop before the next-to-last get_slot_xmins call as well. It may be that there is no race condition there because the standby_2 server is shut down at that point, but I'm quite tired of fighting with this test script. The empirical evidence that it's safe, from the buildfarm, is no stronger than the evidence for the other call that nightjar just proved unsafe. The only remaining get_slot_xmins calls without wait_slot_xmins protection are the first two, which should be OK since nothing has happened at that point. It's tempting to ignore that special case and merge get_slot_xmins and wait_slot_xmins into a single function. I didn't go that far though. Discussion: https://postgr.es/m/[email protected]
2017-08-08Fix replication origin-related race conditionsAlvaro Herrera
Similar to what was fixed in commit 9915de6c1cb2 for replication slots, but this time it's related to replication origins: DROP SUBSCRIPTION attempts to drop the replication origin, but that fails if the replication worker process hasn't yet marked it unused. This causes failures in the buildfarm: ERROR: could not drop replication origin with OID 1, in use by PID 34069 Like the aforementioned commit, fix by having the process running DROP SUBSCRIPTION sleep until the worker marks the the replication origin struct as free. This uses a condition variable on each replication origin shmem state struct, so that the session trying to drop can sleep and expect to be awakened by the process keeping the origin open. Also fix a SGML markup in the previous commit. Discussion: https://postgr.es/m/[email protected]
2017-08-08Fix inadequacies in recently added wait eventsAlvaro Herrera
In commit 9915de6c1cb2, we introduced a new wait point for replication slots and incorrectly labelled it as wait event PG_WAIT_LOCK. That's wrong, so invent an appropriate new wait event instead, and document it properly. While at it, fix numerous other problems in the vicinity: - two different walreceiver wait events were being mixed up in a single wait event (which wasn't documented either); split it out so that they can be distinguished, and document the new events properly. - ParallelBitmapPopulate was documented but didn't exist. - ParallelBitmapScan was not documented (I think this should be called "ParallelBitmapScanInit" instead.) - Logical replication wait events weren't documented - various symbols had been added in dartboard order in various places. Put them in alphabetical order instead, as was originally intended. Discussion: https://postgr.es/m/[email protected]
2017-08-08Mark variable as const to prevent compiler warningTomas Vondra
The quote_guc_value() result was assigned to regular (char *) variable, resulting in compiler warning about discarding const qualifier. Fix by marking the variable as 'const' too.
2017-08-08Use sort_pathkeys instead of query_pathkeys in standard_plannerTomas Vondra
When adding the top-level remote subquery, the code used query_pathkeys, but that seems to be incorrect as those may be group_pathkeys, as set by standard_qp_callback(). Consider this query from xc_groupby tests: select count(*) from xc_groupby_def where a is not null group by a order by 1; planned like this QUERY PLAN ------------------------------------------------------------ Remote Subquery Scan on all Output: count(*), a Sort Key: xc_groupby_def.a -> Sort Output: (count(*)), a Sort Key: (count(*)) -> HashAggregate Output: count(*), a Group Key: xc_groupby_def.a -> Seq Scan on public.xc_groupby_def Output: a, b Filter: (xc_groupby_def.a IS NOT NULL) (12 rows) That's clearly incorrect, because the final sort key should be count(*) and not xc_groupby_def.a (which is, in fact the group key). For some reason this did not cause issues on XL 9.5, but apparently the upper-planner pathification changed the code in a way that affected the top-level remote subquery. To fix this, simply use sort_pathkeys instead of query_pathkeys. That fixes the plans, and also identifies a number of additional plans in regression tests that were in fact incorrect (but no one noticed). Several plans stopped producing results with stable ordering, so fix that by adding an explicit ORDER BY clause.
2017-08-08Fix txid test casePavan Deolasee
- Accept expected output difference because FirstNormalTransactionId's status is reported as 'committed' in XL. This happens because the oldestXmin is advanced lazily in XL and hence clog truncation happens lazily too. - Accept error message because of lack of SAVEPOINT support. But we added a new test case to test the functionality
2017-08-08More thorough checks for distribution columns while creating inheritancePavan Deolasee
We now also do checks during CREATE TABLE. Also amend alter_table test case so that a few tables are distributed using round robin method so that the new checks/limitations don't come in their way. Also new test cases added to ensure that the other checks for inheritance are exercised too.
2017-08-08Disclaim xmltable() support for non-UTF8 databases.Noah Misch
The xmltable() implementation mirrors xpath(), including its lack of character encoding awareness.
2017-08-07Stamp 10beta3.Tom Lane
2017-08-07Skip test for IPC::Run if user is overriding our search for PROVE.Tom Lane
The check for IPC::Run we added in commit c254970ad is useful in simple cases, but there are real use-cases where "prove" is coming from a different Perl installation than the "perl" we want to use to build. In such cases asking whether "perl" knows about IPC::Run is irrelevant and can cause an unnecessary configure failure. Hence, if user has specified a value for PROVE, skip the IPC::Run check. Per discussion with Andrew Dunstan. Discussion: https://postgr.es/m/[email protected]
2017-08-07Update SQL features listPeter Eisentraut
2017-08-07Translation updatesPeter Eisentraut
Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git Source-Git-Hash: 1a0b5e655d7871506c2b1c7ba562c2de6b6a55de
2017-08-07Last-minute updates for release notes.Tom Lane
Security: CVE-2017-7546, CVE-2017-7547, CVE-2017-7548
2017-08-07Fix local/remote attribute mix-up in logical replicationPeter Eisentraut
This would lead to failures if local and remote tables have a different column order. The tests previously didn't catch that because they only tested the initial data copy. So add another test that exercises the apply worker. Author: Petr Jelinek <[email protected]>
2017-08-07Fix handling of dropped columns in logical replicationPeter Eisentraut
The relation attribute map was not initialized for dropped columns, leading to errors later on. Author: Petr Jelinek <[email protected]> Reported-by: Scott Milliken <[email protected]> Bug: #14769
2017-08-07Require update permission for the large object written by lo_put().Tom Lane
lo_put() surely should require UPDATE permission, the same as lowrite(), but it failed to check for that, as reported by Chapman Flack. Oversight in commit c50b7c09d; backpatch to 9.4 where that was introduced. Tom Lane and Michael Paquier Security: CVE-2017-7548
2017-08-07Again match pg_user_mappings to information_schema.user_mapping_options.Noah Misch
Commit 3eefc51053f250837c3115c12f8119d16881a2d7 claimed to make pg_user_mappings enforce the qualifications user_mapping_options had been enforcing, but its removal of a longstanding restriction left them distinct when the current user is the subject of a mapping yet has no server privileges. user_mapping_options emits no rows for such a mapping, but pg_user_mappings includes full umoptions. Change pg_user_mappings to show null for umoptions. Back-patch to 9.2, like the above commit. Reviewed by Tom Lane. Reported by Jeff Janes. Security: CVE-2017-7547
2017-08-07Don't allow logging in with empty password.Heikki Linnakangas
Some authentication methods allowed it, others did not. In the client-side, libpq does not even try to authenticate with an empty password, which makes using empty passwords hazardous: an administrator might think that an account with an empty password cannot be used to log in, because psql doesn't allow it, and not realize that a different client would in fact allow it. To clear that confusion and to be be consistent, disallow empty passwords in all authentication methods. All the authentication methods that used plaintext authentication over the wire, except for BSD authentication, already checked that the password received from the user was not empty. To avoid forgetting it in the future again, move the check to the recv_password_packet function. That only forbids using an empty password with plaintext authentication, however. MD5 and SCRAM need a different fix: * In stable branches, check that the MD5 hash stored for the user does not not correspond to an empty string. This adds some overhead to MD5 authentication, because the server needs to compute an extra MD5 hash, but it is not noticeable in practice. * In HEAD, modify CREATE and ALTER ROLE to clear the password if an empty string, or a password hash that corresponds to an empty string, is specified. The user-visible behavior is the same as in the stable branches, the user cannot log in, but it seems better to stop the empty password from entering the system in the first place. Secondly, it is fairly expensive to check that a SCRAM hash doesn't correspond to an empty string, because computing a SCRAM hash is much more expensive than an MD5 hash by design, so better avoid doing that on every authentication. We could clear the password on CREATE/ALTER ROLE also in stable branches, but we would still need to check at authentication time, because even if we prevent empty passwords from being stored in pg_authid, there might be existing ones there already. Reported by Jeroen van der Ham, Ben de Graaff and Jelte Fennema. Security: CVE-2017-7546
2017-08-07Fix function name in code commentPeter Eisentraut
Reported-by: Peter Geoghegan <[email protected]>
2017-08-07Improve wording of subscription refresh debug messagesPeter Eisentraut
Reported-by: Yugo Nagata <[email protected]>
2017-08-07Downgrade subscription refresh messages to DEBUG1Peter Eisentraut
The NOTICE messages about tables being added or removed during subscription refresh would be incorrect and possibly confusing if the transaction rolls back, so silence them but keep them available for debugging. Discussion: https://www.postgresql.org/message-id/CAD21AoAvaXizc2h7aiNyK_i0FQSa-tmhpdOGwbhh7Jy544Ad4Q%40mail.gmail.com
2017-08-07Update RELEASE_CHANGES' example of branch name format.Tom Lane
We're planning to put an underscore before the major version number in branch names for v10 and later. Make sure the recipe in RELEASE_CHANGES reflects that. In passing, add a reminder to consider doing pgindent right before the branch. Discussion: https://postgr.es/m/[email protected]
2017-08-06Release notes for 9.6.4, 9.5.8, 9.4.13, 9.3.18, 9.2.22.Tom Lane
2017-08-06Fix thinko introduced in 2bef06d516460 et al.Andres Freund
The callers for GetOldestSafeDecodingTransactionId() all inverted the argument for the argument introduced in 2bef06d516460. Luckily this appears to be inconsequential for the moment, as we wait for concurrent in-progress transaction when assembling a snapshot. Additionally this could only make a difference when adding a second logical slot, because only a pre-existing slot could cause an issue by lowering the returned xid dangerously much. Reported-By: Antonin Houska Discussion: https://postgr.es/m/32704.1496993134@localhost Backport: 9.4-, where 2bef06d516460 was backpatched to.
2017-08-05Add regression test for wide REPLICA IDENTITY FULL updates.Andres Freund
This just contains the regression tests added by a fix for a 9.4 specific bug regarding $subject. Author: Andres Freund Backpatch: 9.5-
2017-08-05Doc: update v10 release notes through today.Tom Lane
2017-08-05Suppress unused-variable warnings when building with ICU 4.2.Tom Lane
Tidy-up for commit eccead9ed.
2017-08-05Improve configure's check for ICU presence.Tom Lane
Without ICU's header files, "configure --with-icu" would succeed anyway, at least when using the non-pkgconfig-based setup. Then you got a bunch of ugly failures at build. Add an explicit header check to tighten that up.
2017-08-05Make pg_stop_backup's wait_for_archive flag work on standbys.Robert Haas
Previously, it had no effect. Now, if archive_mode=always, it will work, and if not, you'll get a warning. Masahiko Sawada, Michael Paquier, and Robert Haas. The patch as submitted also changed the behavior so that we would write and remove history files on standbys, but that seems like material for a separate patch to me. Discussion: http://postgr.es/m/CAD21AoC2Xw6M=ZJyejq_9d_iDkReC_=rpvQRw5QsyzKQdfYpkw@mail.gmail.com
2017-08-05Add support for ICU 4.2Peter Eisentraut
Supporting ICU 4.2 seems useful because it ships with CentOS 6. Versions before ICU 4.6 don't support pkg-config, so document an installation method without using pkg-config. In ICU 4.2, ucol_getKeywordsForLocale() sometimes returns values that will not be accepted by uloc_toLanguageTag(). Skip loading keyword variants in that version. Reported-by: Victor Wagner <[email protected]>
2017-08-05Fix bug in deciding whether to scan newly-attached partition.Robert Haas
If the table being attached had different attribute numbers than the parent, the old code could incorrectly decide it needed to be scanned. Amit Langote, reviewed by Ashutosh Bapat Discussion: http://postgr.es/m/CA+TgmobexgbBr2+Utw-pOMw9uxaBRKRjMW_-mmzKKx9PejPLMg@mail.gmail.com
2017-08-05Only kill sync workers at commit time in subscription DDLPeter Eisentraut
This allows a transaction abort to avoid killing those workers. Author: Petr Jelinek <[email protected]>
2017-08-04hash: Immediately after a bucket split, try to clean the old bucket.Robert Haas
If it works, then we won't be storing two copies of all the tuples that were just moved. If not, VACUUM will still take care of it eventually. Per a report from AP and analysis from Amit Kapila, it seems that a bulk load can cause splits fast enough that VACUUM won't deal with the problem in time to prevent bloat. Amit Kapila; I rewrote the comment. Discussion: http://postgr.es/m/[email protected]
2017-08-04First-draft release notes for 9.6.4.Tom Lane
As usual, the release notes for other branches will be made by cutting these down, but put them up for community review first.
2017-08-04Message style improvementsPeter Eisentraut
2017-08-04hash: Increase the number of possible overflow bitmaps by 8x.Robert Haas
Per a report from AP, it's not that hard to exhaust the supply of bitmap pages if you create a table with a hash index and then insert a few billion rows - and then you start getting errors when you try to insert additional rows. In the particular case reported by AP, there's another fix that we can make to improve recycling of overflow pages, which is another way to avoid the error, but there may be other cases where this problem happens and that fix won't help. So let's buy ourselves as much headroom as we can without rearchitecting anything. The comments claim that the old limit was 64GB, but it was really only 32GB, because we didn't use all the bits in the page for bitmap bits - only the largest power of 2 that could fit after deducting space for the page header and so forth. Thus, we have 4kB per page for bitmap bits, not 8kB. The new limit is thus actually 8 times the old *real* limit but only 4 times the old *purported* limit. Since this breaks on-disk compatibility, bump HASH_VERSION. We've already done this earlier in this release cycle, so this doesn't cause any incremental inconvenience for people using pg_upgrade from releases prior to v10. However, users who use pg_upgrade to reach 10beta3 or later from 10beta2 or earlier will need to REINDEX any hash indexes again. Amit Kapila and Robert Haas Discussion: http://postgr.es/m/[email protected]
2017-08-04Apply ALTER ... SET NOT NULL recursively in ALTER ... ADD PRIMARY KEY.Tom Lane
If you do ALTER COLUMN SET NOT NULL against an inheritance parent table, it will recurse to mark all the child columns as NOT NULL as well. This is necessary for consistency: if the column is labeled NOT NULL then reading it should never produce nulls. However, that didn't happen in the case where ALTER ... ADD PRIMARY KEY marks a target column NOT NULL that wasn't before. That was questionable from the beginning, and now Tushar Ahuja points out that it can lead to dump/restore failures in some cases. So let's make that case recurse too. Although this is meant to fix a bug, it's enough of a behavioral change that I'm pretty hesitant to back-patch, especially in view of the lack of similar field complaints. It doesn't seem to be too late to put it into v10 though. Michael Paquier, editorialized on slightly by me Discussion: https://postgr.es/m/[email protected]
2017-08-04Disallow SSL session tickets.Tom Lane
We don't actually support session tickets, since we do not create an SSL session identifier. But it seems that OpenSSL will issue a session ticket on-demand anyway, which will then fail when used. This results in reconnection failures when using ticket-aware client-side SSL libraries (such as the Npgsql .NET driver), as reported by Shay Rojansky. To fix, just tell OpenSSL not to issue tickets. At some point in the far future, we might consider enabling tickets instead. But the security implications of that aren't entirely clear; and besides it would have little benefit except for very short-lived database connections, which is Something We're Bad At anyhow. It would take a lot of other work to get to a point where that would really be an exciting thing to do. While at it, also tell OpenSSL not to use a session cache. This doesn't really do anything, since a backend would never populate the cache anyway, but it might gain some micro-efficiencies and/or reduce security exposures. Patch by me, per discussion with Heikki Linnakangas and Shay Rojansky. Back-patch to all supported versions. Discussion: https://postgr.es/m/CADT4RqBU8N-csyZuzaook-c795dt22Zcwg1aHWB6tfVdAkodZA@mail.gmail.com
2017-08-04Check for partitioned table correctly.Pavan Deolasee
While checking where to forward DROP TABLE command, we were not checking for partitioned table correctly. That resuled in incorrectly sending DROP TABLE to remote coordinator for temporary partitioned tables.
2017-08-04Correct a mistake occurred during merging sequence.c codePavan Deolasee
We were incorrectly overwriting the 'cached' value in the SeqTable element, thus causing another request to the GTM when nextval is fetched. This resulted in an unintentional gaps in the sequence values. This patch fixes that, though we might still get gaps unless sequence_range is set to 1. But this is by design to reduce repeated round trips to the GTM.
2017-08-04Further unify ROLE and USER command grammar rulesPeter Eisentraut
ALTER USER ... SET did not support all the syntax variants of ALTER ROLE ... SET. Fix that, and to avoid further deviations of this kind, unify many the grammar rules for ROLE/USER/GROUP commands. Reported-by: Pavel Golub <[email protected]>
2017-08-03Fix pg_dump/pg_restore to emit REFRESH MATERIALIZED VIEW commands last.Tom Lane
Because we push all ACL (i.e. GRANT/REVOKE) restore steps to the end, materialized view refreshes were occurring while the permissions on referenced objects were still at defaults. This led to failures if, say, an MV owned by user A reads from a table owned by user B, even if B had granted the necessary privileges to A. We've had multiple complaints about that type of restore failure, most recently from Jordan Gigov. The ideal fix for this would be to start treating ACLs as dependency- sortable objects, rather than hard-wiring anything about their dump order (the existing approach is a messy kluge dating to commit dc0e76ca3). But that's going to be a rather major change, and it certainly wouldn't lead to a back-patchable fix. As a short-term solution, convert the existing two-pass hack (ie, normal objects then ACLs) to a three-pass hack, ie, normal objects then ACLs then matview refreshes. Because this happens in RestoreArchive(), it will also fix the problem when restoring from an existing archive-format dump. (Note this means that if a matview refresh would have failed under the permissions prevailing at dump time, it'll fail during restore as well. We'll define that as user error rather than something we should try to work around.) To avoid performance loss in parallel restore, we need the matview refreshes to still be parallelizable. Hence, clean things up enough so that both ACLs and matviews are handled by the parallel restore infrastructure, instead of reverting back to serial restore for ACLs. There is still a final serial step, but it shouldn't normally have to do anything; it's only there to try to recover if we get stuck due to some problem like unresolved circular dependencies. Patch by me, but it owes something to an earlier attempt by Kevin Grittner. Back-patch to 9.3 where materialized views were introduced. Discussion: https://postgr.es/m/[email protected]
2017-08-03Fix build on zlib-less environmentsAlvaro Herrera
Commit 4d57e8381677 added support for getting I/O errors out of zlib, but it introduced a portability problem for systems without zlib. Repair by wrapping the zlib call inside #ifdef and restore the original code in the other branch. This serves to illustrate the inadequacy of the zlib abstraction in pg_backup_archiver: there is no way to call gzerror() in that abstraction. This means that the several places that call GZREAD and GZWRITE are currently doing error reporting wrongly, but ENOTIME to get it fixed before next week's release set. Backpatch to 9.4, like the commit that introduced the problem.
2017-08-03Fix lock upgrade hazard in ATExecAttachPartition.Robert Haas
Amit Langote Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com
2017-08-03Code beautification for ATExecAttachPartition.Robert Haas
Amit Langote Discussion: http://postgr.es/m/CAFjFpReT_kq_uwU_B8aWDxR7jNGE=P0iELycdq5oupi=xSQTOw@mail.gmail.com
2017-08-03Allow a foreign table CHECK constraint to be initially NOT VALID.Robert Haas
For a table, the constraint can be considered validated immediately, because the table must be empty. But for a foreign table this is not necessarily the case. Fixes a bug in commit f27a6b15e6566fba7748d0d9a3fc5bcfd52c4a1b. Amit Langote, with some changes by me. Discussion: http://postgr.es/m/[email protected]
2017-08-03Improve ExecModifyTable comments.Robert Haas
Some of these comments wrongly implied that only an AFTER ROW trigger will cause a 'wholerow' attribute to be present for a foreign table, but a BEFORE ROW trigger can have the same effect. Others implied that it would always be present for a foreign table, but that's not true either. Etsuro Fujita and Robert Haas Discussion: http://postgr.es/m/[email protected]
2017-08-03Teach map_partition_varattnos to handle whole-row expressions.Robert Haas
Otherwise, partitioned tables with RETURNING expressions or subject to a WITH CHECK OPTION do not work properly. Amit Langote, reviewed by Amit Khandekar and Etsuro Fujita. A few comment changes by me. Discussion: http://postgr.es/m/[email protected]
2017-08-03Add new files to nls.mk and add translation markersPeter Eisentraut
2017-08-02Fix pg_dump's errno checking for zlib I/OAlvaro Herrera
Some error reports were reporting strerror(errno), which for some error conditions coming from zlib are wrong, resulting in confusing reports such as pg_restore: [compress_io] could not read from input file: Success which makes no sense. To correctly extract the error message we need to use gzerror(), so let's do that. This isn't as comprehensive or as neat as I would like, but at least it should improve things in many common cases. The zlib abstraction in compress_io does not seem to be applied consistently enough; we could perhaps improve that, but it seems master-only material, not a bug fix for back-patching. This problem goes back all the way, but I decided to apply back to 9.4 only, because older branches don't contain commit 14ea89366 which this change depends on. Authors: Vladimir Kunschikov, Álvaro Herrera Discussion: https://postgr.es/m/[email protected]