Skip to content
Snippets Groups Projects
  1. Feb 02, 2014
    • Andrew Dunstan's avatar
      Fix makefile syntax. · c0770299
      Andrew Dunstan authored
      c0770299
    • Tom Lane's avatar
      Fix some wide-character bugs in the text-search parser. · 8be095ce
      Tom Lane authored
      In p_isdigit and other character class test functions generated by the
      p_iswhat macro, the code path for non-C locales with multibyte encodings
      contained a bogus pointer cast that would accidentally fail to malfunction
      if types wchar_t and wint_t have the same width.  Apparently that is true
      on most platforms, but not on recent Cygwin releases.  Remove the cast,
      as it seems completely unnecessary (I think it arose from a false analogy
      to the need to cast to unsigned char when dealing with the <ctype.h>
      functions).  Per bug #8970 from Marco Atzeri.
      
      In the same functions, the code path for C locale with a multibyte encoding
      simply ANDed each wide character with 0xFF before passing it to the
      corresponding <ctype.h> function.  This could result in false positive
      answers for some non-ASCII characters, so use a range test instead.
      Noted by me while investigating Marco's complaint.
      
      Also, remove some useless though not actually buggy maskings and casts
      in the hand-coded p_isalnum and p_isalpha functions, which evidently
      got tested a bit more carefully than the macro-generated functions.
      8be095ce
  2. Feb 01, 2014
    • Andrew Dunstan's avatar
      fix whitespace · 7fe4e357
      Andrew Dunstan authored
      7fe4e357
    • Tom Lane's avatar
      Fix some more bugs in signal handlers and process shutdown logic. · 81b116d9
      Tom Lane authored
      WalSndKill was doing things exactly backwards: it should first clear
      MyWalSnd (to stop signal handlers from touching MyWalSnd->latch),
      then disown the latch, and only then mark the WalSnd struct unused by
      clearing its pid field.
      
      Also, WalRcvSigUsr1Handler and worker_spi_sighup failed to preserve
      errno, which is surely a requirement for any signal handler.
      
      Per discussion of recent buildfarm failures.  Back-patch as far
      as the relevant code exists.
      81b116d9
    • Andrew Dunstan's avatar
      Don't use deprecated dllwrap on Cygwin. · fad44375
      Andrew Dunstan authored
      The preferred method is to use "cc -shared", and this allows binaries
      to be rebased if required, unlike dllwrap.
      
      Backpatch to 9.0 where we have buildfarm coverage.
      
      There are still some issues with Cygwin, especially modern Cygwin, but
      this helps us get closer to good support.
      
      Marco Atzeri.
      fad44375
    • Andrew Dunstan's avatar
      Copy the libpq DLL to the bin directory on Mingw and Cygwin. · 6e96d4db
      Andrew Dunstan authored
      This has long been done by the MSVC build system, and has caused
      confusion in the past when programs like psql have failed to start
      because they can't find the DLL. If it's in the same directory as it now
      will be they will find it.
      
      Backpatch to all live branches.
      6e96d4db
    • Robert Haas's avatar
      Clear MyProc and MyProcSignalState before they become invalid. · ebe33446
      Robert Haas authored
      Evidence from buildfarm member crake suggests that the new test_shm_mq
      module is routinely crashing the server due to the arrival of a SIGUSR1
      after the shared memory segment has been unmapped.  Although processes
      using the new dynamic background worker facilities are more likely to
      receive a SIGUSR1 around this time, the problem is also possible on older
      branches, so I'm back-patching the parts of this change that apply to
      older branches as far as they apply.
      
      It's already generally the case that code checks whether these pointers
      are NULL before deferencing them, so the important thing is mostly to
      make sure that they do get set to NULL before they become invalid.  But
      in master, there's one case in procsignal_sigusr1_handler that lacks a
      NULL guard, so add that.
      
      Patch by me; review by Tom Lane.
      ebe33446
  3. Jan 31, 2014
  4. Jan 30, 2014
    • Tom Lane's avatar
      Fix unsafe references to errno within error messaging logic. · 3e71ce1e
      Tom Lane authored
      Various places were supposing that errno could be expected to hold still
      within an ereport() nest or similar contexts.  This isn't true necessarily,
      though in some cases it accidentally failed to fail depending on how the
      compiler chanced to order the subexpressions.  This class of thinko
      explains recent reports of odd failures on clang-built versions, typically
      missing or inappropriate HINT fields in messages.
      
      Problem identified by Christian Kruse, who also submitted the patch this
      commit is based on.  (I fixed a few issues in his patch and found a couple
      of additional places with the same disease.)
      
      Back-patch as appropriate to all supported branches.
      3e71ce1e
  5. Jan 23, 2014
    • Fujii Masao's avatar
      Fix bugs in PQhost(). · ea311bfd
      Fujii Masao authored
      In the platform that doesn't support Unix-domain socket, when
      neither host nor hostaddr are specified, the default host
      'localhost' is used to connect to the server and PQhost() must
      return that, but it didn't. This patch fixes PQhost() so that
      it returns the default host in that case.
      
      Also this patch fixes PQhost() so that it doesn't return
      Unix-domain socket directory path in the platform that doesn't
      support Unix-domain socket.
      
      Back-patch to all supported versions.
      ea311bfd
  6. Jan 22, 2014
    • Stephen Frost's avatar
      Allow type_func_name_keywords in even more places · c0e6169e
      Stephen Frost authored
      A while back, 2c92edad allowed
      type_func_name_keywords to be used in more places, including role
      identifiers.  Unfortunately, that commit missed out on cases where
      name_list was used for lists-of-roles, eg: for DROP ROLE.  This
      resulted in the unfortunate situation that you could CREATE a role
      with a type_func_name_keywords-allowed identifier, but not DROP it
      (directly- ALTER could be used to rename it to something which
      could be DROP'd).
      
      This extends allowing type_func_name_keywords to places where role
      lists can be used.
      
      Back-patch to 9.0, as 2c92edad was.
      c0e6169e
  7. Jan 21, 2014
    • Tom Lane's avatar
      Tweak parse location assignment for CURRENT_DATE and related constructs. · 27ab1eb7
      Tom Lane authored
      All these constructs generate parse trees consisting of a Const and
      a run-time type coercion (perhaps a FuncExpr or a CoerceViaIO).  Modify
      the raw parse output so that we end up with the original token's location
      attached to the type coercion node while the Const has location -1;
      before, it was the other way around.  This makes no difference in terms
      of what exprLocation() will say about the parse tree as a whole, so it
      should not have any user-visible impact.  The point of changing it is that
      we do not want contrib/pg_stat_statements to treat these constructs as
      replaceable constants.  It will do the right thing if the Const has
      location -1 rather than a valid location.
      
      This is a pretty ugly hack, but then this code is ugly already; we should
      someday replace this translation with special-purpose parse node(s) that
      would allow ruleutils.c to reconstruct the original query text.
      
      (See also commit 5d3fcc4c, which also
      hacked location assignment rules for the benefit of pg_stat_statements.)
      
      Back-patch to 9.2 where pg_stat_statements grew the ability to recognize
      replaceable constants.
      
      Kyotaro Horiguchi
      27ab1eb7
  8. Jan 19, 2014
    • Stephen Frost's avatar
      Allow SET TABLESPACE to database default · 1fe06595
      Stephen Frost authored
      We've always allowed CREATE TABLE to create tables in the database's default
      tablespace without checking for CREATE permissions on that tablespace.
      Unfortunately, the original implementation of ALTER TABLE ... SET TABLESPACE
      didn't pick up on that exception.
      
      This changes ALTER TABLE ... SET TABLESPACE to allow the database's default
      tablespace without checking for CREATE rights on that tablespace, just as
      CREATE TABLE works today.  Users could always do this through a series of
      commands (CREATE TABLE ... AS SELECT * FROM ...; DROP TABLE ...; etc), so
      let's fix the oversight in SET TABLESPACE's original implementation.
      1fe06595
  9. Jan 18, 2014
  10. Jan 15, 2014
    • Tom Lane's avatar
      Improve FILES section of psql reference page. · aa00af38
      Tom Lane authored
      Primarily, explain where to find the system-wide psqlrc file, per recent
      gripe from John Sutton.  Do some general wordsmithing and improve the
      markup, too.
      
      Also adjust psqlrc.sample so its comments about file location are somewhat
      trustworthy.  (Not sure why we bother with this file when it's empty,
      but whatever.)
      
      Back-patch to 9.2 where the startup file naming scheme was last changed.
      aa00af38
  11. Jan 14, 2014
    • Tom Lane's avatar
      Fix multiple bugs in index page locking during hot-standby WAL replay. · ad2e041a
      Tom Lane authored
      In ordinary operation, VACUUM must be careful to take a cleanup lock on
      each leaf page of a btree index; this ensures that no indexscans could
      still be "in flight" to heap tuples due to be deleted.  (Because of
      possible index-tuple motion due to concurrent page splits, it's not enough
      to lock only the pages we're deleting index tuples from.)  In Hot Standby,
      the WAL replay process must likewise lock every leaf page.  There were
      several bugs in the code for that:
      
      * The replay scan might come across unused, all-zero pages in the index.
      While btree_xlog_vacuum itself did the right thing (ie, nothing) with
      such pages, xlogutils.c supposed that such pages must be corrupt and
      would throw an error.  This accounts for various reports of replication
      failures with "PANIC: WAL contains references to invalid pages".  To
      fix, add a ReadBufferMode value that instructs XLogReadBufferExtended
      not to complain when we're doing this.
      
      * btree_xlog_vacuum performed the extra locking if standbyState ==
      STANDBY_SNAPSHOT_READY, but that's not the correct test: we won't open up
      for hot standby queries until the database has reached consistency, and
      we don't want to do the extra locking till then either, for fear of reading
      corrupted pages (which bufmgr.c would complain about).  Fix by exporting a
      new function from xlog.c that will report whether we're actually in hot
      standby replay mode.
      
      * To ensure full coverage of the index in the replay scan, btvacuumscan
      would emit a dummy WAL record for the last page of the index, if no
      vacuuming work had been done on that page.  However, if the last page
      of the index is all-zero, that would result in corruption of said page,
      since the functions called on it weren't prepared to handle that case.
      There's no need to lock any such pages, so change the logic to target
      the last normal leaf page instead.
      
      The first two of these bugs were diagnosed by Andres Freund, the other one
      by me.  Fixes based on ideas from Heikki Linnakangas and myself.
      
      This has been wrong since Hot Standby was introduced, so back-patch to 9.0.
      ad2e041a
  12. Jan 13, 2014
    • Tom Lane's avatar
      Fix possible buffer overrun in contrib/pg_trgm. · 299498d6
      Tom Lane authored
      Allow for the possibility that folding a string to lower case makes it
      longer (due to replacing a character with a longer multibyte character).
      This doesn't change the number of trigrams that will be extracted, but
      it does affect the required size of an intermediate buffer in
      generate_trgm().  Per bug #8821 from Ufuk Kayserilioglu.
      
      Also install some checks that the input string length is not so large
      as to cause overflow in the calculations of palloc request sizes.
      
      Back-patch to all supported versions.
      299498d6
    • Heikki Linnakangas's avatar
      Fix calculation of ISMN check digit. · f6d6b42f
      Heikki Linnakangas authored
      This has always been broken, so back-patch to all supported versions.
      
      Fabien COELHO
      f6d6b42f
  13. Jan 11, 2014
    • Tom Lane's avatar
      Fix possible crashes due to using elog/ereport too early in startup. · 2de90518
      Tom Lane authored
      Per reports from Andres Freund and Luke Campbell, a server failure during
      set_pglocale_pgservice results in a segfault rather than a useful error
      message, because the infrastructure needed to use ereport hasn't been
      initialized; specifically, MemoryContextInit hasn't been called.
      One known cause of this is starting the server in a directory it
      doesn't have permission to read.
      
      We could try to prevent set_pglocale_pgservice from using anything that
      depends on palloc or elog, but that would be messy, and the odds of future
      breakage seem high.  Moreover there are other things being called in main.c
      that look likely to use palloc or elog too --- perhaps those things
      shouldn't be there, but they are there today.  The best solution seems to
      be to move the call of MemoryContextInit to very early in the backend's
      real main() function.  I've verified that an elog or ereport occurring
      immediately after that is now capable of sending something useful to
      stderr.
      
      I also added code to elog.c to print something intelligible rather than
      just crashing if MemoryContextInit hasn't created the ErrorContext.
      This could happen if MemoryContextInit itself fails (due to malloc
      failure), and provides some future-proofing against someone trying to
      sneak in new code even earlier in server startup.
      
      Back-patch to all supported branches.  Since we've only heard reports of
      this type of failure recently, it may be that some recent change has made
      it more likely to see a crash of this kind; but it sure looks like it's
      broken all the way back.
      2de90518
    • Tom Lane's avatar
      Fix compute_scalar_stats() for case that all values exceed WIDTH_THRESHOLD. · f0381680
      Tom Lane authored
      The standard typanalyze functions skip over values whose detoasted size
      exceeds WIDTH_THRESHOLD (1024 bytes), so as to limit memory bloat during
      ANALYZE.  However, we (I think I, actually :-() failed to consider the
      possibility that *every* non-null value in a column is too wide.  While
      compute_minimal_stats() seems to behave reasonably anyway in such a case,
      compute_scalar_stats() just fell through and generated no pg_statistic
      entry at all.  That's unnecessarily pessimistic: we can still produce
      valid stanullfrac and stawidth values in such cases, since we do include
      too-wide values in the average-width calculation.  Furthermore, since the
      general assumption in this code is that too-wide values are probably all
      distinct from each other, it seems reasonable to set stadistinct to -1
      ("all distinct").
      
      Per complaint from Kadri Raudsepp.  This has been like this since roughly
      neolithic times, so back-patch to all supported branches.
      f0381680
  14. Jan 09, 2014
    • Michael Meskes's avatar
      Fix descriptor output in ECPG. · 799728b0
      Michael Meskes authored
      While working on most platforms the old way sometimes created alignment
      problems. This should fix it. Also the regresion tests were updated to test for
      the reported case.
      
      Report and fix by MauMau <maumau307@gmail.com>
      799728b0
    • Tom Lane's avatar
      Fix "cannot accept a set" error when only some arms of a CASE return a set. · 97a39f29
      Tom Lane authored
      In commit c1352052, I implemented an
      optimization that assumed that a function's argument expressions would
      either always return a set (ie multiple rows), or always not.  This is
      wrong however: we allow CASE expressions in which some arms return a set
      of some type and others just return a scalar of that type.  There may be
      other examples as well.  To fix, replace the run-time test of whether an
      argument returned a set with a static precheck (expression_returns_set).
      This adds a little bit of query startup overhead, but it seems barely
      measurable.
      
      Per bug #8228 from David Johnston.  This has been broken since 8.0,
      so patch all supported branches.
      97a39f29
  15. Jan 08, 2014
    • Heikki Linnakangas's avatar
      Fix pause_at_recovery_target + recovery_target_inclusive combination. · 3bd8987e
      Heikki Linnakangas authored
      If pause_at_recovery_target is set, recovery pauses *before* applying the
      target record, even if recovery_target_inclusive is set. If you then
      continue with pg_xlog_replay_resume(), it will apply the target record
      before ending recovery. In other words, if you log in while it's paused
      and verify that the database looks OK, ending recovery changes its state
      again, possibly destroying data that you were tring to salvage with PITR.
      
      Backpatch to 9.1, this has been broken since pause_at_recovery_target was
      added.
      3bd8987e
    • Heikki Linnakangas's avatar
      Fix bug in determining when recovery has reached consistency. · 82c75f9d
      Heikki Linnakangas authored
      When starting WAL replay from an online checkpoint, the last replayed WAL
      record variable was initialized using the checkpoint record's location, even
      though the records between the REDO location and the checkpoint record had
      not been replayed yet. That was noted as "slightly confusing" but harmless
      in the comment, but in some cases, it fooled CheckRecoveryConsistency to
      incorrectly conclude that we had already reached a consistent state
      immediately at the beginning of WAL replay. That caused the system to accept
      read-only connections in hot standby mode too early, and also PANICs with
      message "WAL contains references to invalid pages".
      
      Fix by initializing the variables to the REDO location instead.
      
      In 9.2 and above, change CheckRecoveryConsistency() to use
      lastReplayedEndRecPtr variable when checking if backup end location has
      been reached. It was inconsistently using EndRecPtr for that check, but
      lastReplayedEndRecPtr when checking min recovery point. It made no
      difference before this patch, because in all the places where
      CheckRecoveryConsistency was called the two variables were the same, but
      it was always an accident waiting to happen, and would have been wrong
      after this patch anyway.
      
      Report and analysis by Tomonari Katsumata, bug #8686. Backpatch to 9.0,
      where hot standby was introduced.
      82c75f9d
  16. Jan 07, 2014
    • Bruce Momjian's avatar
      Update copyright for 2014 · 8aa6912b
      Bruce Momjian authored
      Update all files in head, and files COPYRIGHT and legal.sgml in all back
      branches.
      8aa6912b
    • Magnus Hagander's avatar
      Move permissions check from do_pg_start_backup to pg_start_backup · 61d4d14e
      Magnus Hagander authored
      And the same for do_pg_stop_backup. The code in do_pg_* is not allowed
      to access the catalogs. For manual base backups, the permissions
      check can be handled in the calling function, and for streaming
      base backups only users with the required permissions can get past
      the authentication step in the first place.
      
      Reported by Antonin Houska, diagnosed by Andres Freund
      61d4d14e
    • Magnus Hagander's avatar
      Avoid including tablespaces inside PGDATA twice in base backups · 2edf3e82
      Magnus Hagander authored
      If a tablespace was crated inside PGDATA it was backed up both as part
      of the PGDATA backup and as the backup of the tablespace. Avoid this
      by skipping any directory inside PGDATA that contains one of the active
      tablespaces.
      
      Dimitri Fontaine and Magnus Hagander
      2edf3e82
  17. Jan 04, 2014
    • Tom Lane's avatar
      Fix translatability markings in psql, and add defenses against future bugs. · fa28f9cb
      Tom Lane authored
      Several previous commits have added columns to various \d queries without
      updating their translate_columns[] arrays, leading to potentially incorrect
      translations in NLS-enabled builds.  Offenders include commit 89368676
      (added prosecdef to \df+), c9ac00e6 (added description to \dc+) and
      3b17efdf (added description to \dC+).  Fix those cases back to 9.3 or
      9.2 as appropriate.
      
      Since this is evidently more easily missed than one would like, in HEAD
      also add an Assert that the supplied array is long enough.  This requires
      an API change for printQuery(), so it seems inappropriate for back
      branches, but presumably all future changes will be tested in HEAD anyway.
      
      In HEAD and 9.3, also clean up a whole lot of sloppiness in the emitted
      SQL for \dy (event triggers): lack of translatability due to failing to
      pass words-to-be-translated through gettext_noop(), inadequate schema
      qualification, and sloppy formatting resulting in unnecessarily ugly
      -E output.
      
      Peter Eisentraut and Tom Lane, per bug #8702 from Sergey Burladyan
      fa28f9cb
  18. Jan 01, 2014
  19. Dec 29, 2013
    • Kevin Grittner's avatar
      Don't attempt to limit target database for pg_restore. · df090b39
      Kevin Grittner authored
      There was an apparent attempt to limit the target database for
      pg_restore to version 7.1.0 or later.  Due to a leading zero this
      was interpreted as an octal number, which allowed targets with
      version numbers down to 2.87.36.  The lowest actual release above
      that was 6.0.0, so that was effectively the limit.
      
      Since the success of the restore attempt will depend primarily on
      on what statements were generated by the dump run, we don't want
      pg_restore trying to guess whether a given target should be allowed
      based on version number.  Allow a connection to any version.  Since
      it is very unlikely that anyone would be using a recent version of
      pg_restore to restore to a pre-6.0 database, this has little to no
      practical impact, but it makes the code less confusing to read.
      
      Issue reported and initial patch suggestion from Joel Jacobson
      based on an article by Andrey Karpov reporting on issues found by
      PVS-Studio static code analyzer.  Final patch based on analysis by
      Tom Lane.  Back-patch to all supported branches.
      df090b39
  20. Dec 27, 2013
    • Andrew Dunstan's avatar
      Properly detect invalid JSON numbers when generating JSON. · 4825a9e9
      Andrew Dunstan authored
      Instead of looking for characters that aren't valid in JSON numbers, we
      simply pass the output string through the JSON number parser, and if it
      fails the string is quoted. This means among other things that money and
      domains over money will be quoted correctly and generate valid JSON.
      
      Fixes bug #8676 reported by Anderson Cristian da Silva.
      
      Backpatched to 9.2 where JSON generation was introduced.
      4825a9e9
    • Kevin Grittner's avatar
      Fix misplaced right paren bugs in pgstatfuncs.c. · 150a30e1
      Kevin Grittner authored
      The bug would only show up if the C sockaddr structure contained
      zero in the first byte for a valid address; otherwise it would
      fail to fail, which is probably why it went unnoticed for so long.
      
      Patch submitted by Joel Jacobson after seeing an article by Andrey
      Karpov in which he reports finding this through static code
      analysis using PVS-Studio.  While I was at it I moved a definition
      of a local variable referenced in the buggy code to a more local
      context.
      
      Backpatch to all supported branches.
      150a30e1
  21. Dec 15, 2013
    • Tatsuo Ishii's avatar
      Add "SHIFT_JIS" as an accepted encoding name for locale checking. · 0c07ef1a
      Tatsuo Ishii authored
      When locale is "ja_JP.SJIS", nl_langinfo(CODESET) returns "SHIFT_JIS"
      on some platforms, at least on RedHat Linux. So the encoding/locale
      match table (encoding_match_list) needs the entry. Otherwise client
      encoding is set to SQL_ASCII.
      
      Back patch to all supported branches.
      0c07ef1a
  22. Dec 14, 2013
    • Tom Lane's avatar
      Fix inherited UPDATE/DELETE with UNION ALL subqueries. · 5d545b7e
      Tom Lane authored
      Fix an oversight in commit b3aaf908: we do
      indeed need to process the planner's append_rel_list when copying RTE
      subqueries, because if any of them were flattenable UNION ALL subqueries,
      the append_rel_list shows which subquery RTEs were pulled up out of which
      other ones.  Without this, UNION ALL subqueries aren't correctly inserted
      into the update plans for inheritance child tables after the first one,
      typically resulting in no update happening for those child table(s).
      Per report from Victor Yegorov.
      
      Experimentation with this case also exposed a fault in commit
      a7b96538: if an inherited UPDATE/DELETE
      was proven totally dummy by constraint exclusion, we might arrive at
      add_rtes_to_flat_rtable with root->simple_rel_array being NULL.  This
      should be interpreted as not having any RelOptInfos.  I chose to code
      the guard as a check against simple_rel_array_size, so as to also
      provide some protection against indexing off the end of the array.
      
      Back-patch to 9.2 where the faulty code was added.
      5d545b7e
  23. Dec 13, 2013
    • Tom Lane's avatar
      Add HOLD/RESUME_INTERRUPTS in HandleCatchupInterrupt/HandleNotifyInterrupt. · d20eec82
      Tom Lane authored
      This prevents a possible longjmp out of the signal handler if a timeout
      or SIGINT occurs while something within the handler has transiently set
      ImmediateInterruptOK.  For safety we must hold off the timeout or cancel
      error until we're back in mainline, or at least till we reach the end of
      the signal handler when ImmediateInterruptOK was true at entry.  This
      syncs these functions with the logic now present in handle_sig_alarm.
      
      AFAICT there is no live bug here in 9.0 and up, because I don't think we
      currently can wait for any heavyweight lock inside these functions, and
      there is no other code (except read-from-client) that will turn on
      ImmediateInterruptOK.  However, that was not true pre-9.0: in older
      branches ProcessIncomingNotify might block trying to lock pg_listener, and
      then a SIGINT could lead to undesirable control flow.  It might be all
      right anyway given the relatively narrow code ranges in which NOTIFY
      interrupts are enabled, but for safety's sake I'm back-patching this.
      d20eec82
  24. Dec 12, 2013
  25. Dec 11, 2013
    • Tom Lane's avatar
      Tweak placement of explicit ANALYZE commands in the regression tests. · 9c9a1f2e
      Tom Lane authored
      Make the COPY test, which loads most of the large static tables used in
      the tests, also explicitly ANALYZE those tables.  This allows us to get
      rid of various ad-hoc, and rather redundant, ANALYZE commands that had
      gotten stuck into various test scripts over time to ensure we got
      consistent plan choices.  (We could have done a database-wide ANALYZE,
      but that would cause stats to get attached to the small static tables
      too, which results in plan changes compared to the historical behavior.
      I'm not sure that's a good idea, so not going that far for now.)
      
      Back-patch to 9.0, since 9.0 and 9.1 are currently sometimes failing
      regression tests for lack of an "ANALYZE tenk1" in the subselect test.
      There's no need for this in 8.4 since we didn't print any plans back
      then.
      9c9a1f2e
  26. Dec 10, 2013
    • Tom Lane's avatar
      Fix possible crash with nested SubLinks. · f5d9fdcc
      Tom Lane authored
      An expression such as WHERE (... x IN (SELECT ...) ...) IN (SELECT ...)
      could produce an invalid plan that results in a crash at execution time,
      if the planner attempts to flatten the outer IN into a semi-join.
      This happens because convert_testexpr() was not expecting any nested
      SubLinks and would wrongly replace any PARAM_SUBLINK Params belonging
      to the inner SubLink.  (I think the comment denying that this case could
      happen was wrong when written; it's certainly been wrong for quite a long
      time, since very early versions of the semijoin flattening logic.)
      
      Per report from Teodor Sigaev.  Back-patch to all supported branches.
      f5d9fdcc
  27. Dec 08, 2013
    • Joe Conway's avatar
      Fix performance regression in dblink connection speed. · 7f4ef622
      Joe Conway authored
      Previous commit e5de6012 modified dblink
      to ensure client encoding matched the server. However the added
      PQsetClientEncoding() call added significant overhead. Restore original
      performance in the common case where client encoding already matches
      server encoding by doing nothing in that case. Applies to all active
      branches.
      
      Issue reported and work sponsored by Zonar Systems.
      7f4ef622
  28. Dec 05, 2013
    • Tom Lane's avatar
      Clear retry flags properly in replacement OpenSSL sock_write function. · 41042970
      Tom Lane authored
      Current OpenSSL code includes a BIO_clear_retry_flags() step in the
      sock_write() function.  Either we failed to copy the code correctly, or
      they added this since we copied it.  In any case, lack of the clear step
      appears to be the cause of the server lockup after connection loss reported
      in bug #8647 from Valentine Gogichashvili.  Assume that this is correct
      coding for all OpenSSL versions, and hence back-patch to all supported
      branches.
      
      Diagnosis and patch by Alexander Kukushkin.
      41042970
Loading