1. 11 3月, 2014 3 次提交
    • T
      Fix tracking of psql script line numbers during \copy from another place. · e85a5ffb
      Tom Lane 提交于
      Commit 08146775 changed do_copy() to
      temporarily scribble on pset.cur_cmd_source.  That was a mighty ugly bit of
      code in any case, but in particular it broke handleCopyIn's ability to tell
      whether it was reading from the current script source file (in which case
      pset.lineno should be incremented for each line of COPY data), or from
      someplace else (in which case it shouldn't).  The former case still worked,
      the latter not so much.  The visible effect was that line numbers reported
      for errors in a script file would be wrong if there were an earlier \copy
      that was reading anything other than inline-in-the-script-file data.
      
      To fix, introduce another pset field that holds the file do_copy wants the
      COPY code to use.  This is a little bit ugly, but less so than passing the
      file down explicitly through several layers that aren't COPY-specific.
      
      Extracted from a larger patch by Kumar Rajeev Rastogi; that patch also
      changes printing of COPY command tags, which is not a bug fix and shouldn't
      get back-patched.  This particular idea was from a suggestion by Amit
      Khandekar, if I'm reading the thread correctly.
      
      Back-patch to 9.2 where the faulty code was introduced.
      e85a5ffb
    • R
      Allow dynamic shared memory segments to be kept until shutdown. · 8722017b
      Robert Haas 提交于
      Amit Kapila, reviewed by Kyotaro Horiguchi, with some further
      changes by me.
      8722017b
    • R
      Allow logical decoding via the walsender interface. · 5a991ef8
      Robert Haas 提交于
      In order for this to work, walsenders need the optional ability to
      connect to a database, so the "replication" keyword now allows true
      or false, for backward-compatibility, and the new value "database"
      (which causes the "dbname" parameter to be respected).
      
      walsender needs to loop not only when idle but also when sending
      decoded data to the user and when waiting for more xlog data to decode.
      This means that there are now three separate loops inside walsender.c;
      although some refactoring has been done here, this is still a bit ugly.
      
      Andres Freund, with contributions from Álvaro Herrera, and further
      review by me.
      5a991ef8
  2. 10 3月, 2014 1 次提交
    • R
      Teach on_exit_reset() to discard pending cleanups for dsm. · cb9a0c79
      Robert Haas 提交于
      If a postmaster child invokes fork() and then calls on_exit_reset, that
      should be sufficient to let it exit() without breaking anything, but
      dynamic shared memory broke that by not updating on_exit_reset() to
      discard callbacks registered with dynamic shared memory segments.
      
      Per investigation of a complaint from Tom Lane.
      cb9a0c79
  3. 09 3月, 2014 5 次提交
  4. 08 3月, 2014 7 次提交
    • B
      pg_upgrade: document delete problems with tablespaces inside the cluster directory · 8879fa09
      Bruce Momjian 提交于
      Per report by Marc Mamin
      8879fa09
    • B
      doc: improve server's keepalive description · ea43af38
      Bruce Momjian 提交于
      Use superior libpq keepalive description for the server-level
      parameters.
      
      Per report by Tatsuo Ishii and Marko Tiikkaja
      ea43af38
    • B
      docs: improve TABLE command by showing supported clauses · b0cb40f9
      Bruce Momjian 提交于
      Initial patch by Colin 't Hart
      b0cb40f9
    • T
      Remove unportable use of anonymous unions from reorderbuffer.h. · ea177a3b
      Tom Lane 提交于
      In b89e1510 I had assumed it was ok to use anonymous unions as
      struct members, but while a longstanding extension in many compilers,
      it's only been standardized in C11.
      
      To fix, remove one of the anonymous unions which tried to hide some
      implementation specific enum values and give the other a name. The
      latter unfortunately requires changes in output plugins, but since the
      feature has only been added a few days ago...
      
      Andres Freund
      ea177a3b
    • T
      Fix contrib/postgres_fdw to handle multiple join conditions properly. · 83204e10
      Tom Lane 提交于
      The previous coding supposed that it could consider just a single join
      condition in any one parameterized path for the foreign table.  But in
      reality, the parameterized-path machinery forces all join clauses that are
      "movable to" the foreign table to be evaluated at that node; including
      clauses that we might not consider safe to send across.  Such cases would
      result in an Assert failure in an assert-enabled build, and otherwise in
      sending an unsafe clause to the foreign server, which might result in
      errors or silently-wrong answers.  A lesser problem was that the
      cost/rowcount estimates generated for the parameterized path failed to
      account for any additional join quals that get assigned to the scan.
      
      To fix, rewrite postgresGetForeignPaths so that it correctly collects all
      the movable quals for any one outer relation when generating parameterized
      paths; we'll now generate just one path per outer relation not one per join
      qual.  Also fix bogus assumptions in postgresGetForeignPlan and
      estimate_path_cost_size that only safe-to-send join quals will be
      presented.
      
      Based on complaint from Etsuro Fujita that the path costs were being
      miscalculated, though this is significantly different from his proposed
      patch.
      83204e10
    • B
      release notes: add item missed in 9.2.5 release · 4ea2e2d4
      Bruce Momjian 提交于
      Item is "Prevent errors in WAL replay due to references to uninitialized
      empty pages".
      
      Report and text by Andres Freund
      
      Backpatch through 9.2.
      4ea2e2d4
    • B
      fix ReplicationSlotsCountDBSlots for dropping unrelated databases · 91d9de97
      Bruce Momjian 提交于
      YAMAMOTO Takashi
      91d9de97
  5. 07 3月, 2014 7 次提交
    • H
      Fix dangling smgr_owner pointer when a fake relcache entry is freed. · 55566c9a
      Heikki Linnakangas 提交于
      A fake relcache entry can "own" a SmgrRelation object, like a regular
      relcache entry. But when it was free'd, the owner field in SmgrRelation
      was not cleared, so it was left pointing to free'd memory.
      
      Amazingly this apparently hasn't caused crashes in practice, or we would've
      heard about it earlier. Andres found this with Valgrind.
      
      Report and fix by Andres Freund, with minor modifications by me. Backpatch
      to all supported versions.
      55566c9a
    • H
      Avoid memcpy() with same source and destination address. · ad7b48ea
      Heikki Linnakangas 提交于
      The behavior of that is undefined, although unlikely to lead to problems in
      practice.
      
      Found by running regression tests with Valgrind.
      ad7b48ea
    • H
      Fix name of syslog_ident GUC in docs. · 2b8483d6
      Heikki Linnakangas 提交于
      Michael Paquier
      2b8483d6
    • T
      Avoid getting more than AccessShareLock when deparsing a query. · 7c318749
      Tom Lane 提交于
      In make_ruledef and get_query_def, we have long used AcquireRewriteLocks
      to ensure that the querytree we are about to deparse is up-to-date and
      the schemas of the underlying relations aren't changing.  Howwever, that
      function thinks the query is about to be executed, so it acquires locks
      that are stronger than necessary for the purpose of deparsing.  Thus for
      example, if pg_dump asks to deparse a rule that includes "INSERT INTO t",
      we'd acquire RowExclusiveLock on t.  That results in interference with
      concurrent transactions that might for example ask for ShareLock on t.
      Since pg_dump is documented as being purely read-only, this is unexpected.
      (Worse, it used to actually be read-only; this behavior dates back only
      to 8.1, cf commit ba420024.)
      
      Fix this by adding a parameter to AcquireRewriteLocks to tell it whether
      we want the "real" execution locks or only AccessShareLock.
      
      Report, diagnosis, and patch by Dean Rasheed.  Back-patch to all supported
      branches.
      7c318749
    • H
      isdigit() needs an unsigned char argument. · a0c2fa9b
      Heikki Linnakangas 提交于
      Per the C standard, the routine should be passed an int, with a value that's
      representable as an unsigned char or EOF. Passing a signed char is wrong,
      because a negative value is not representable as an unsigned char.
      Unfortunately no compiler warns about that.
      a0c2fa9b
    • H
      Send keepalives from walsender even when busy sending WAL. · 94ae6ba7
      Heikki Linnakangas 提交于
      If walsender doesn't hear from the client for the time specified by
      wal_sender_timeout, it will conclude the connection or client is dead, and
      disconnect. When half of wal_sender_timeout has elapsed, it sends a ping
      to the client, leaving it the remainig half of wal_sender_timeout to
      respond. However, it only checked if half of wal_sender_timeout had elapsed
      when it was about to sleep, so if it was busy sending WAL to the client for
      long enough, it would not send the ping request in time. Then the client
      would not know it needs to send a reply, and the walsender will disconnect
      even though the client is still alive. Fix that.
      
      Andres Freund, reviewed by Robert Haas, and some further changes by me.
      Backpatch to 9.3. Earlier versions relied on the client to send the
      keepalives on its own, and hence didn't have this problem.
      94ae6ba7
    • T
      Don't reject ROW_MARK_REFERENCE rowmarks for materialized views. · bf4052fa
      Tom Lane 提交于
      We should allow this so that matviews can be referenced in UPDATE/DELETE
      statements in READ COMMITTED isolation level.  The requirement for that
      is that a re-fetch by TID will see the same row version the query saw
      earlier, which is true of matviews, so there's no reason for the
      restriction.  Per bug #9398.
      
      Michael Paquier, after a suggestion by me
      bf4052fa
  6. 06 3月, 2014 9 次提交
  7. 05 3月, 2014 8 次提交
    • B
      65b96714
    • S
      Allocate fresh memory for post_opts/exec_path · dd917bb7
      Stephen Frost 提交于
      Instead of having read_post_opts() depend on the memory allocated for
      the config file (which is now getting free'd), pg_strdup() for
      post_opts and exec_path (similar to how it's being done elsewhere).
      
      Noted by Thom Brown.
      dd917bb7
    • H
      Do wal_level and hot standby checks when doing crash-then-archive recovery. · 956685f8
      Heikki Linnakangas 提交于
      CheckRequiredParameterValues() should perform the checks if archive recovery
      was requested, even if we are going to perform crash recovery first.
      
      Reported by Kyotaro HORIGUCHI. Backpatch to 9.2, like the crash-then-archive
      recovery mode.
      956685f8
    • H
      Fix lastReplayedEndRecPtr calculation when starting from shutdown checkpoint. · af246c37
      Heikki Linnakangas 提交于
      When entering crash recovery followed by archive recovery, and the latest
      checkpoint is a shutdown checkpoint, and there are no more WAL records to
      replay before transitioning from crash to archive recovery, we would not
      immediately allow read-only connections in hot standby mode even if we
      could. That's because when starting from a shutdown checkpoint, we set
      lastReplayedEndRecPtr incorrectly to the record before the checkpoint
      record, instead of the checkpoint record itself. We don't run the redo
      routine of the shutdown checkpoint record, but starting recovery from it
      goes through the same motions, so it should be considered as replayed.
      
      Reported by Kyotaro HORIGUCHI. All versions with hot standby are affected,
      so backpatch to 9.0.
      af246c37
    • S
      Fix issues with pg_ctl · eb933162
      Stephen Frost 提交于
      The new, small, free_readfile managed to have bug in it which could
      cause it to try and free something it shouldn't, and fix the case
      where it was being called with an invalid pointer leading to a
      segfault.
      
      Noted by Bruce, issues introduced and fixed by me.
      eb933162
    • P
      Fix whitespace · 6f37c080
      Peter Eisentraut 提交于
      6f37c080
    • A
      Provide a FORCE NULL option to COPY in CSV mode. · 3b5e03dc
      Andrew Dunstan 提交于
      This forces an input field containing the quoted null string to be
      returned as a NULL. Without this option, only unquoted null strings
      behave this way. This helps where some CSV producers insist on quoting
      every field, whether or not it is needed. The option takes a list of
      fields, and only applies to those columns. There is an equivalent
      column-level option added to file_fdw.
      
      Ian Barwick, with some tweaking by Andrew Dunstan, reviewed by Payal
      Singh.
      3b5e03dc
    • A
      auto_explain: Add logging of trigger execution · e2a0fc53
      Alvaro Herrera 提交于
      Author: Kyotaro HORIGUCHI
      Reviewed-by: Jaime Casanova
      e2a0fc53