Correctifs appliqués

Tom Lane pushed:

  • Fix unportable usage of printf("%m"). While glibc's version of printf accepts %m, most others do not; to be portable, we have to do it the hard way with %strerror(errno). pg_verify_checksums evidently did not get that memo. Noted %while fooling around with NetBSD-current, which generates a compiler warning %for this mistake. %
  • Fix unsafe usage of strerror(errno) within ereport(). This is the converse of the unsafe-usage-of-%m problem: the reason ereport/elog provide that format code is mainly to dodge the hazard of errno getting changed before control reaches functions within the arguments of the macro. I only found one instance of this hazard, but it's been there since 9.4 :-(.
  • Doc: fix bogus cross-reference link. An xref to a <para>'s ID isn't very helpful because paras don't have names. This causes a warning while building PDFs, though for some reason not while building HTML. The link arguably went to the wrong place, too. To fix, introduce a sub-section we can reference.
  • Improve spelling of new FINALFUNC_MODIFY aggregate attribute. I'd used SHARABLE as a value originally, but Peter Eisentraut points out that dictionaries agree that SHAREABLE is the preferred spelling. Run around and change that before it's too late. Discussion:
  • Doc: preliminary list of PG11 major features. This might get bike-shedded a bit later, but it's better than shipping beta1 with no list. Jonathan Katz Discussion:
  • Stamp 11beta1.
  • Widen COPY FROM's current-line-number counter from 32 to 64 bits. Because the code for the HEADER option skips a line when this counter is zero, a very long COPY FROM WITH HEADER operation would drop a line every 2^32 lines. A lesser but still unfortunate problem is that errors would show a wrong input line number for errors occurring beyond the 2^31'st input line. While such large input streams seemed impractical when this code was first written, they're not any more. Widening the counter (and some associated variables) to uint64 should be enough to prevent problems for the foreseeable future. David Rowley Discussion:
  • Fix incorrect ordering of operations in pg_resetwal and pg_rewind. Commit c37b3d08c dropped its added GetDataDirectoryCreatePerm call into the wrong place in pg_resetwal.c, namely after the chdir to DataDir. That broke invocations using a relative path, as reported by Tushar Ahuja. We could have left it where it was and changed the argument to be ".", but that'd result in a rather confusing error message in event of a failure, so re-ordering seems like a better solution. Similarly reorder operations in pg_rewind.c. The issue there is that it doesn't seem like a good idea to do any actual operations before the not-root check (on Unix) or the restricted token acquisition (on Windows). I don't know that this is an actual bug, but I'm definitely not convinced that it isn't, either. Assorted other code review for c37b3d08c and da9b580d8: fix some misspelled or otherwise badly worded comments, put the #include for <sys/stat.h> where it actually belongs, etc. Discussion:
  • Remove configure's check for nonstandard "long long" printf modifiers. We used to claim to support platforms using 'q' or 'I64' as the printf length modifier for long long int, by dint of replacing snprintf with our own code which uses the C99 standard 'll' modifier. But that is only adequate if we use INT64_MODIFIER only in snprintf-based calls, not directly with the platform's native printf or fprintf. Which hasn't been the case for years. We had not noticed, partially because of inadequate test coverage, and partially because the buildfarm is almost completely bare of machines that won't take 'll'. The last one seems to have been frogmouth, which was adjusted recently so that it will take 'll'. We might as well just give up on the pretense that anything else works, and save ourselves some configure cycles. Discussion: Discussion:
  • Fix simple_prompt() to disable echo on Windows when stdin != terminal. If echo = false, simple_prompt() is supposed to prevent echoing the input (for password input). However, the Windows implementation applied the mode change to STD_INPUT_HANDLE. That would not have the desired effect if stdin isn't actually the terminal, for instance if the user is piping something into psql. Fix it to apply the mode change to the correct input file, so that passwords do not echo in such cases. In passing, shorten and de-uglify this code by using #elif rather than an #if nest and removing some duplicated code. Back-patch to all supported versions. To simplify that, also back-patch the portions of commit 9daec77e1 that got rid of an unnecessary malloc/free in the same area. Matthew Stickney (cosmetic changes by me) Discussion:
  • Properly schema-qualify additional object types in getObjectDescription(). Collations, conversions, extended statistics objects (in >= v10), and all four types of text search objects have schema-qualified names. getObjectDescription() ignored that and would emit just the base name of the object, potentially producing wrong or at least highly misleading output. Fix it to add the schema name whenever the object is not "visible" in the current search path, as is the rule for other schema-qualifiable object types. Although in common situations the output won't change, this seems to me (tgl) to be a bug worthy of back-patching, hence do so. Kyotaro Horiguchi, per a complaint from me Discussion:
  • Fix objectaddress.c code for publication relations. getObjectDescription and getObjectIdentity failed to schema-qualify the name of the published table, which is bad in getObjectDescription and unforgivable in getObjectIdentity. Actually, getObjectIdentity failed to emit the table's name at all unless "objname" output is requested, which accidentally works for some (all?) extant callers but is clearly not the intended API. Somebody had also not gotten the memo that the output of getObjectIdentity is not to be translated. To fix getObjectDescription, I made it call getRelationDescription, which required refactoring the translatable string for the case, but is more future-proof in case we ever publish relations that aren't plain tables. While at it, I made the English output look like "publication of table X in publication Y"; the added "of" seems to me to make it read much better. Back-patch to v10 where publications were introduced. Discussion:
  • Improve translatability of some getObjectDescription() messages. Refactor some cases in getObjectDescription so that the translator has more control over phrase order in the translated messages. This doesn't cause any changes in the English results. (I was sorely tempted to reorder "... belonging to role %s in schema %s" into "... in schema %s belonging to role %s", but refrained.) In principle we could back-patch this, but since translators have not complained about these cases previously, it seems better not to thrash the translatable strings in back branches. Kyotaro Horiguchi, tweaked a bit by me Discussion:
  • Improve English wording of some other getObjectDescription() messages. Print columns as "column C of <relation>" rather than "<relation> column C". This seems to read noticeably better in English, as evidenced by the regression test output changes, and the code change also makes it possible for translators to adjust the phrase order in other languages. Also change the output for OCLASS_DEFAULT from "default for %s" to "default value for %s". This seems to read better and is also more consistent with the output of, for instance, getObjectTypeDescription(). Kyotaro Horiguchi, per a complaint from me Discussion:
  • Update sepgsql regression test output for getObjectDescription() changes. Missed in commit b86b7bfa3. Per buildfarm.
  • Update non-default collation tests for getObjectDescription() changes. Sigh, also missed in commit b86b7bfa3. Per buildfarm.
  • Fix misidentification of SQL statement type in plpgsql's exec_stmt_execsql. To distinguish SQL statements that are INSERT/UPDATE/DELETE from other ones, exec_stmt_execsql looked at the post-rewrite form of the statement rather than the original. This is problematic because it did that only during first execution of the statement (in a session), but the correct answer could change later due to addition or removal of DO INSTEAD rules during the session. That could lead to an Assert failure, as reported by Tushar Ahuja and Robert Haas. In non-assert builds, there's a hazard that we would fail to enforce STRICT behavior when we'd be expected to. That would happen if an initially present DO INSTEAD, that replaced the original statement with one of a different type, were removed; after that the statement should act "normally", including strictness enforcement, but it didn't. (The converse case of enforcing strictness when we shouldn't doesn't seem to be a hazard, as addition of a DO INSTEAD that changes the statement type would always lead to acting as though the statement returned zero rows, so that the strictness error could not fire.) To fix, inspect the original form of the statement not the post-rewrite form, making it valid to assume the answer can't change intra-session. This should lead to the same answer in every case except when there is a DO INSTEAD that changes the statement type; we will now set mod_stmt=true anyway, while we would not have done so before. That breaks the Assert in the SPI_OK_REWRITTEN code path, which expected the latter behavior. It might be all right to assert mod_stmt rather than !mod_stmt there, but I'm not entirely convinced that that'd always hold, so just remove the assertion altogether. This has been broken for a long time, so back-patch to all supported branches. Discussion:
  • Update a couple of long-obsolete comments in pg_type.h.

Peter Eisentraut pushed:

Andrew Gierth pushed:

Heikki Linnakangas pushed:

Bruce Momjian pushed:

Andrew Dunstan pushed:

Magnus Hagander pushed:

Correctifs en attente

Marina Polyakova sent in another revision of a patch to fix serialization and deadlock errors in pgbench.

Carter Thaxton sent in three revisions of a patch to add an --include-table-data-where option to pg_dump, to export only a subset of table data.

Masahiko Sawada sent in another revision of a patch to move relation extension locks out of heavyweight lock manager.

Andres Freund sent in two more revisions of a patch to fix some fsync issues.

Micha�l Paquier sent in a patch to rework scram_channel_binding to protect from downgrade attacks.

Heikki Linnakangas sent in a patch to enable caching subquery results.

Micha�l Paquier sent in two more revisions of a patch to fix some error handling for read() and errno.

Masahiko Sawada sent in a patch to fix a possible bug in logical replication by ensuring that the next record found is valid.

Robbie Harwood sent in three more revisions of a patch to enable GSSAPI encryption.

Laurenz Albe sent in a patch to ensure that unlogged tables don't get locked.

Micha�l Paquier sent in another revision of a patch to prevent PANIC during crash recovery of a recently promoted standby.

Justin Pryzby sent in two revisions of a patch to improve the documentation on partition pruning.

Micha�l Paquier sent in another revision of a patch to simplify final sync in pg_rewind's target folder and add --no-sync.

Marina Polyakova sent in another revision of a patch to precalculate stable or immutable functions, stable or immutable operators and other nonvolatile expressions.

Ashwin Agrawal sent in a patch to avert tablespace path collision for primary and standby.

Kyotaro HORIGUCHI sent in a patch to set debug_query_string in some places where it is not already being set.

Micha�l Paquier sent in a patch to make pg_replication_slot_advance return NULL instead of 0/0 when the slot is not advanced.

Kyotaro HORIGUCHI sent in two revisions of a patch to fix the fact that XLogWrite was uing palloc within a critical section.

Thomas Munro sent in a patch to implement UNDO logs.

Vik Fearing sent in a patch to implement the PERIOD type per the SQL standard.

Andrew Dunstan sent in another revision of a patch to fix some Perl warnings under MSVC.

Mark Rofail sent in another revision of a patch to implement foreign key arrays.