1. 17 Oct, 2014 1 commit
    • Stephen Frost's avatar
      Fix pg_dump for UPDATE policies · 389573fd
      Stephen Frost authored
      pg_dump had the wrong character for update and so was failing when
      attempts were made to pg_dump databases with UPDATE policies.
      
      Pointed out by Fujii Masao (thanks!)
      389573fd
  2. 16 Oct, 2014 1 commit
    • Tom Lane's avatar
      Support timezone abbreviations that sometimes change. · b2cbced9
      Tom Lane authored
      Up to now, PG has assumed that any given timezone abbreviation (such as
      "EDT") represents a constant GMT offset in the usage of any particular
      region; we had a way to configure what that offset was, but not for it
      to be changeable over time.  But, as with most things horological, this
      view of the world is too simplistic: there are numerous regions that have
      at one time or another switched to a different GMT offset but kept using
      the same timezone abbreviation.  Almost the entire Russian Federation did
      that a few years ago, and later this month they're going to do it again.
      And there are similar examples all over the world.
      
      To cope with this, invent the notion of a "dynamic timezone abbreviation",
      which is one that is referenced to a particular underlying timezone
      (as defined in the IANA timezone database) and means whatever it currently
      means in that zone.  For zones that use or have used daylight-savings time,
      the standard and DST abbreviations continue to have the property that you
      can specify standard or DST time and get that time offset whether or not
      DST was theoretically in effect at the time.  However, the abbreviations
      mean what they meant at the time in question (or most recently before that
      time) rather than being absolutely fixed.
      
      The standard abbreviation-list files have been changed to use this behavior
      for abbreviations that have actually varied in meaning since 1970.  The
      old simple-numeric definitions are kept for abbreviations that have not
      changed, since they are a bit faster to resolve.
      
      While this is clearly a new feature, it seems necessary to back-patch it
      into all active branches, because otherwise use of Russian zone
      abbreviations is going to become even more problematic than it already was.
      This change supersedes the changes in commit 513d06de et al to modify the
      fixed meanings of the Russian abbreviations; since we've not shipped that
      yet, this will avoid an undesirably incompatible (not to mention incorrect)
      change in behavior for timestamps between 2011 and 2014.
      
      This patch makes some cosmetic changes in ecpglib to keep its usage of
      datetime lookup tables as similar as possible to the backend code, but
      doesn't do anything about the increasingly obsolete set of timezone
      abbreviation definitions that are hard-wired into ecpglib.  Whatever we
      do about that will likely not be appropriate material for back-patching.
      Also, a potential free() of a garbage pointer after an out-of-memory
      failure in ecpglib has been fixed.
      
      This patch also fixes pre-existing bugs in DetermineTimeZoneOffset() that
      caused it to produce unexpected results near a timezone transition, if
      both the "before" and "after" states are marked as standard time.  We'd
      only ever thought about or tested transitions between standard and DST
      time, but that's not what's happening when a zone simply redefines their
      base GMT offset.
      
      In passing, update the SGML documentation to refer to the Olson/zoneinfo/
      zic timezone database as the "IANA" database, since it's now being
      maintained under the auspices of IANA.
      b2cbced9
  3. 15 Oct, 2014 1 commit
    • Tom Lane's avatar
      Print planning time only in EXPLAIN ANALYZE, not plain EXPLAIN. · 90063a76
      Tom Lane authored
      We've gotten enough push-back on that change to make it clear that it
      wasn't an especially good idea to do it like that.  Revert plain EXPLAIN
      to its previous behavior, but keep the extra output in EXPLAIN ANALYZE.
      Per discussion.
      
      Internally, I set this up as a separate flag ExplainState.summary that
      controls printing of planning time and execution time.  For now it's
      just copied from the ANALYZE option, but we could consider exposing it
      to users.
      90063a76
  4. 14 Oct, 2014 7 commits
    • Alvaro Herrera's avatar
      Blind attempt at fixing Win32 pg_dump issues · 076d29a1
      Alvaro Herrera authored
      Per buildfarm failures
      076d29a1
    • Alvaro Herrera's avatar
      pg_dump: Reduce use of global variables · 0eea8047
      Alvaro Herrera authored
      Most pg_dump.c global variables, which were passed down individually to
      dumping routines, are now grouped as members of the new DumpOptions
      struct, which is used as a local variable and passed down into routines
      that need it.  This helps future development efforts; in particular it
      is said to enable a mode in which a parallel pg_dump run can output
      multiple streams, and have them restored in parallel.
      
      Also take the opportunity to clean up the pg_dump header files somewhat,
      to avoid circularity.
      
      Author: Joachim Wieland, revised by Álvaro Herrera
      Reviewed by Peter Eisentraut
      0eea8047
    • Heikki Linnakangas's avatar
      Fix deadlock with LWLockAcquireWithVar and LWLockWaitForVar. · e0d97d77
      Heikki Linnakangas authored
      LWLockRelease should release all backends waiting with LWLockWaitForVar,
      even when another backend has already been woken up to acquire the lock,
      i.e. when releaseOK is false. LWLockWaitForVar can return as soon as the
      protected value changes, even if the other backend will acquire the lock.
      Fix that by resetting releaseOK to true in LWLockWaitForVar, whenever
      adding itself to the wait queue.
      
      This should fix the bug reported by MauMau, where the system occasionally
      hangs when there is a lot of concurrent WAL activity and a checkpoint.
      Backpatch to 9.4, where this code was added.
      e0d97d77
    • Heikki Linnakangas's avatar
      Fix typo in docs. · 0ff5047d
      Heikki Linnakangas authored
      Shigeru Hanada
      0ff5047d
    • Peter Eisentraut's avatar
      doc: Improve ALTER VIEW / SET documentation · db75e524
      Peter Eisentraut authored
      The way the ALTER VIEW / SET options were listed in the synopsis was
      very confusing.  Move the list to the main description, similar to how
      the ALTER TABLE reference page does it.
      db75e524
    • Peter Eisentraut's avatar
      doc: Fix copy-and-paste mistakes · 5dc4b50b
      Peter Eisentraut authored
      5dc4b50b
    • Peter Eisentraut's avatar
      psql: Fix \? output alignment · 7ce09e61
      Peter Eisentraut authored
      This was inadvertently changed in commit c64e68fd.
      7ce09e61
  5. 13 Oct, 2014 11 commits
  6. 12 Oct, 2014 2 commits
    • Peter Eisentraut's avatar
      pg_recvlogical: Improve --help output · a0fb59d8
      Peter Eisentraut authored
      List the actions first, as they are the most important options.  Group
      the other options more sensibly, consistent with the man page.  Correct
      a few typographical errors, clarify some things.
      
      Also update the pg_receivexlog --help output to make it a bit more
      consistent with that of pg_recvlogical.
      a0fb59d8
    • Peter Eisentraut's avatar
      Message improvements · b7a08c80
      Peter Eisentraut authored
      b7a08c80
  7. 11 Oct, 2014 5 commits
  8. 10 Oct, 2014 2 commits
    • Heikki Linnakangas's avatar
      Remove unnecessary initialization of local variables. · 733be2a5
      Heikki Linnakangas authored
      Oops, forgot these in the prveious commit.
      733be2a5
    • Heikki Linnakangas's avatar
      Change the way encoding and locale checks are done in pg_upgrade. · 33755e8e
      Heikki Linnakangas authored
      Lc_collate and lc_ctype have been per-database settings since server version
      8.4, but pg_upgrade was still treating them as cluster-wide options. It
      fetched the values for the template0 databases in old and new cluster, and
      compared them. That's backwards; the encoding and locale of the template0
      database doesn't matter, as template0 is guaranteed to contain only ASCII
      characters. But if there are any other databases that exist on both clusters
      (in particular template1 and postgres databases), their encodings and
      locales must be compatible.
      
      Also, make the locale comparison more lenient. If the locale names are not
      equal, try to canonicalize both of them by passing them to setlocale(). We
      used to do that only when upgrading from 9.1 or below, but it seems like a
      good idea even with newer versions. If we change the canonical form of a
      locale, this allows pg_upgrade to still work. I'm about to do just that to
      fix bug #11431, by mapping a locale name that contains non-ASCII characters
      to a pure-ASCII alias of the same locale.
      
      No backpatching, because earlier versions of pg_upgrade still support
      upgrading from 8.3 servers. That would be more complicated, so it doesn't
      seem worth it, given that we haven't received any complaints about this
      from users.
      33755e8e
  9. 09 Oct, 2014 1 commit
  10. 08 Oct, 2014 2 commits
    • Alvaro Herrera's avatar
      Split builtins.h to a new header ruleutils.h · 7b1c2a0f
      Alvaro Herrera authored
      The new header contains many prototypes for functions in ruleutils.c
      that are not exposed to the SQL level.
      
      Reviewed by Andres Freund and Michael Paquier.
      7b1c2a0f
    • Robert Haas's avatar
      Extend shm_mq API with new functions shm_mq_sendv, shm_mq_set_handle. · 7bb0e974
      Robert Haas authored
      shm_mq_sendv sends a message to the queue assembled from multiple
      locations.  This is expected to be used by forthcoming patches to
      allow frontend/backend protocol messages to be sent via shm_mq, but
      might be useful for other purposes as well.
      
      shm_mq_set_handle associates a BackgroundWorkerHandle with an
      already-existing shm_mq_handle.  This solves a timing problem when
      creating a shm_mq to communicate with a newly-launched background
      worker: if you attach to the queue first, and the background worker
      fails to start, you might block forever trying to do I/O on the queue;
      but if you start the background worker first, but then die before
      attaching to the queue, the background worrker might block forever
      trying to do I/O on the queue.  This lets you attach before starting
      the worker (so that the worker is protected) and then associate the
      BackgroundWorkerHandle later (so that you are also protected).
      
      Patch by me, reviewed by Stephen Frost.
      7bb0e974
  11. 07 Oct, 2014 3 commits
    • Alvaro Herrera's avatar
      Implement SKIP LOCKED for row-level locks · df630b0d
      Alvaro Herrera authored
      This clause changes the behavior of SELECT locking clauses in the
      presence of locked rows: instead of causing a process to block waiting
      for the locks held by other processes (or raise an error, with NOWAIT),
      SKIP LOCKED makes the new reader skip over such rows.  While this is not
      appropriate behavior for general purposes, there are some cases in which
      it is useful, such as queue-like tables.
      
      Catalog version bumped because this patch changes the representation of
      stored rules.
      
      Reviewed by Craig Ringer (based on a previous attempt at an
      implementation by Simon Riggs, who also provided input on the syntax
      used in the current patch), David Rowley, and Álvaro Herrera.
      
      Author: Thomas Munro
      df630b0d
    • Robert Haas's avatar
      Fix typo in elog message. · c421efd2
      Robert Haas authored
      c421efd2
    • Tom Lane's avatar
      Fix array overrun in ecpg's version of ParseDateTime(). · 55bfdd1c
      Tom Lane authored
      The code wrote a value into the caller's field[] array before checking
      to see if there was room, which of course is backwards.  Per report from
      Michael Paquier.
      
      I fixed the equivalent bug in the backend's version of this code way back
      in 630684d3, but failed to think about ecpg's copy.  Fortunately
      this doesn't look like it would be exploitable for anything worse than a
      core dump: an external attacker would have no control over the single word
      that gets written.
      55bfdd1c
  12. 06 Oct, 2014 4 commits
    • Stephen Frost's avatar
      Clean up Create/DropReplicationSlot query buffer · 273b29db
      Stephen Frost authored
      CreateReplicationSlot() and DropReplicationSlot() were not cleaning up
      the query buffer in some cases (mostly error conditions) which meant a
      small leak.  Not generally an issue as the error case would result in an
      immediate exit, but not difficult to fix either and reduces the number
      of false positives from code analyzers.
      
      In passing, also add appropriate PQclear() calls to RunIdentifySystem().
      
      Pointed out by Coverity.
      273b29db
    • Andres Freund's avatar
      Add support for managing physical replication slots to pg_receivexlog. · d9f38c7a
      Andres Freund authored
      pg_receivexlog already has the capability to use a replication slot to
      reserve WAL on the upstream node. But the used slot currently has to
      be created via SQL.
      
      To allow using slots directly, without involving SQL, add
      --create-slot and --drop-slot actions, analogous to the logical slot
      manipulation support in pg_recvlogical.
      
      Author: Michael Paquier
      Discussion: CABUevEx+zrOHZOQg+dPapNPFRJdsk59b=TSVf30Z71GnFXhQaw@mail.gmail.com
      d9f38c7a
    • Andres Freund's avatar
      Rename pg_recvlogical's --create/--drop to --create-slot/--drop-slot. · c8b6cba8
      Andres Freund authored
      A future patch (9.5 only) adds slot management to pg_receivexlog. The
      verbs create/drop don't seem descriptive enough there. It seems better
      to rename pg_recvlogical's commands now, in beta, than live with the
      inconsistency forever.
      
      The old form (e.g. --drop) will still be accepted by virtue of most
      getopt_long() options accepting abbreviations for long commands.
      
      Backpatch to 9.4 where pg_recvlogical was introduced.
      
      Author: Michael Paquier and Andres Freund
      Discussion: CAB7nPqQtt79U6FmhwvgqJmNyWcVCbbV-nS72j_jyPEopERg9rg@mail.gmail.com
      c8b6cba8
    • Peter Eisentraut's avatar
      Translation updates · 1ec4a970
      Peter Eisentraut authored
      1ec4a970