1. 29 Jan, 2013 2 commits
    • Heikki Linnakangas's avatar
      Skip truncating ON COMMIT DELETE ROWS temp tables, if the transaction hasn't · c9d7dbac
      Heikki Linnakangas authored
      touched any temporary tables.
      
      We could try harder, and keep track of whether we've inserted to any temp
      tables, rather than accessed them, and which temp tables have been inserted
      to. But this is dead simple, and already covers many interesting scenarios.
      c9d7dbac
    • Simon Riggs's avatar
      Fast promote mode skips checkpoint at end of recovery. · fd4ced52
      Simon Riggs authored
      pg_ctl promote -m fast will skip the checkpoint at end of recovery so that we
      can achieve very fast failover when the apply delay is low. Write new WAL record
      XLOG_END_OF_RECOVERY to allow us to switch timeline correctly for downstream log
      readers. If we skip synchronous end of recovery checkpoint we request a normal
      spread checkpoint so that the window of re-recovery is low.
      
      Simon Riggs and Kyotaro Horiguchi, with input from Fujii Masao.
      Review by Heikki Linnakangas
      fd4ced52
  2. 28 Jan, 2013 3 commits
    • Alvaro Herrera's avatar
      REASSIGN OWNED: handle shared objects, too · ee22c55f
      Alvaro Herrera authored
      Give away ownership of shared objects (databases, tablespaces) along
      with local objects, per original code intention.  Try to make the
      documentation clearer, too.
      
      Per discussion about DROP OWNED's brokenness, in bug #7748.
      
      This is not backpatched because it'd require some refactoring of the
      ALTER/SET OWNER code for databases and tablespaces.
      ee22c55f
    • Alvaro Herrera's avatar
      DROP OWNED: don't try to drop tablespaces/databases · ec41b8ed
      Alvaro Herrera authored
      My "fix" for bugs #7578 and #6116 on DROP OWNED at fe3b5eb0 not only
      misstated that it applied to REASSIGN OWNED (which it did not affect),
      but it also failed to fix the problems fully, because I didn't test the
      case of owned shared objects.  Thus I created a new bug, reported by
      Thomas Kellerer as #7748, which would cause DROP OWNED to fail with a
      not-for-user-consumption error message.  The code would attempt to drop
      the database, which not only fails to work because the underlying code
      does not support that, but is a pretty dangerous and undesirable thing
      to be doing as well.
      
      This patch fixes that bug by having DROP OWNED only attempt to process
      shared objects when grants on them are found, ignoring ownership.
      
      Backpatch to 8.3, which is as far as the previous bug was backpatched.
      ec41b8ed
    • Heikki Linnakangas's avatar
      Handle SPIErrors raised directly in PL/Python code. · 316186f2
      Heikki Linnakangas authored
      If a PL/Python function raises an SPIError (or one if its subclasses)
      directly with python's raise statement, treat it the same as an SPIError
      generated internally. In particular, if the user sets the sqlstate
      attribute, preserve that.
      
      Oskari Saarenmaa and Jan Urbański, reviewed by Karl O. Pinc.
      316186f2
  3. 27 Jan, 2013 1 commit
  4. 26 Jan, 2013 6 commits
    • Tom Lane's avatar
      Make LATERAL implicit for functions in FROM. · 2378d79a
      Tom Lane authored
      The SQL standard does not have general functions-in-FROM, but it does
      allow UNNEST() there (see the <collection derived table> production),
      and the semantics of that are defined to include lateral references.
      So spec compliance requires allowing lateral references within UNNEST()
      even without an explicit LATERAL keyword.  Rather than making UNNEST()
      a special case, it seems best to extend this flexibility to any
      function-in-FROM.  We'll still allow LATERAL to be written explicitly
      for clarity's sake, but it's now a noise word in this context.
      
      In theory this change could result in a change in behavior of existing
      queries, by allowing what had been an outer reference in a function-in-FROM
      to be captured by an earlier FROM-item at the same level.  However, all
      pre-9.3 PG releases have a bug that causes them to match variable
      references to earlier FROM-items in preference to outer references (and
      then throw an error).  So no previously-working query could contain the
      type of ambiguity that would risk a change of behavior.
      
      Per a suggestion from Andrew Gierth, though I didn't use his patch.
      2378d79a
    • Bruce Momjian's avatar
      Update comments in new DROP IF EXISTS code; commit message update · 8865fe0a
      Bruce Momjian authored
      DROP IF EXISTS with a missing schema in commit
      7e2322df applies not only to tables, but
      to DROP IF EXISTS with missing schemas for indexes, views, sequences,
      and foreign tables.  Yeah!
      8865fe0a
    • Bruce Momjian's avatar
      Update LookupExplicitNamespace() comments; commit message update · 51cfb87a
      Bruce Momjian authored
      Also, commit 7e2322df affected DROP
      TABLE IF EXISTS, not CREATE TABLE IF EXISTS.
      51cfb87a
    • Bruce Momjian's avatar
      Issue ERROR if FREEZE mode can't be honored by COPY · 4deb57de
      Bruce Momjian authored
      Previously non-honored FREEZE mode was ignored.  This also issues an
      appropriate error message based on the cause of the failure, per
      suggestion from Tom.  Additional regression test case added.
      4deb57de
    • Bruce Momjian's avatar
      Allow CREATE TABLE IF EXIST so succeed if the schema is nonexistent · 7e2322df
      Bruce Momjian authored
      Previously, CREATE TABLE IF EXIST threw an error if the schema was
      nonexistent.  This was done by passing 'missing_ok' to the function that
      looks up the schema oid.
      7e2322df
    • Bruce Momjian's avatar
      doc: revert 80c20fcf and · 7c83619b
      Bruce Momjian authored
      0e93959a
      
      Revert patch that modified doc index mentions of search_path
      
      Per Peter E.
      7c83619b
  5. 25 Jan, 2013 15 commits
  6. 24 Jan, 2013 12 commits
    • Tom Lane's avatar
      Fix SPI documentation for new handling of ExecutorRun's count parameter. · 2ddc600f
      Tom Lane authored
      Since 9.0, the count parameter has only limited the number of tuples
      actually returned by the executor.  It doesn't affect the behavior of
      INSERT/UPDATE/DELETE unless RETURNING is specified, because without
      RETURNING, the ModifyTable plan node doesn't return control to execMain.c
      for each tuple.  And we only check the limit at the top level.
      
      While this behavioral change was unintentional at the time, discussion of
      bug #6572 led us to the conclusion that we prefer the new behavior anyway,
      and so we should just adjust the docs to match rather than change the code.
      Accordingly, do that.  Back-patch as far as 9.0 so that the docs match the
      code in each branch.
      2ddc600f
    • Andrew Dunstan's avatar
      Use correct output device for Windows prompts. · 1068771a
      Andrew Dunstan authored
      This ensures that mapping of non-ascii prompts
      to the correct code page occurs.
      
      Bug report and original patch from Alexander Law,
      reviewed and reworked by Noah Misch.
      
      Backpatch to all live branches.
      1068771a
    • Bruce Momjian's avatar
      pg_upgrade: detect stale postmaster.pid lock files · a9ceaa53
      Bruce Momjian authored
      If the postmaster.pid lock file exists, try starting/stopping the
      cluster to check if the lock file is valid.
      
      Per request from Tom.
      a9ceaa53
    • Alvaro Herrera's avatar
      Redefine HEAP_XMAX_IS_LOCKED_ONLY · 74ebba84
      Alvaro Herrera authored
      Tuples marked SELECT FOR UPDATE in a cluster that's later processed by
      pg_upgrade would have a different infomask bit pattern than those
      produced by 9.3dev; that bit pattern was being seen as "dead" by HEAD
      (because they would fail the "is this tuple locked" test, and so the
      visibility rules would thing they're updated, even though there's no
      HEAP_UPDATED version of them).  In other words, some rows could silently
      disappear after pg_upgrade.
      
      With this new definition, those tuples become visible again.
      
      This is breakage resulting from my commit 0ac5ad51.
      74ebba84
    • Alvaro Herrera's avatar
      Use the catversion to distinguish old/new clusters · 34da7004
      Alvaro Herrera authored
      This makes 9.3 -> 9.3 upgrades work when they cross the commit that
      added persistent multixacts; early 9.3 pg_controldata did not have the
      required oldestMultiXact line, and so would fail to upgrade.
      
      per Bruce Momjian
      34da7004
    • Alvaro Herrera's avatar
      2494a9af
    • Alvaro Herrera's avatar
      Make output identical to pg_resetxlog's · 6772c1e5
      Alvaro Herrera authored
      6772c1e5
    • Simon Riggs's avatar
      Fix rare missing cancellations in Hot Standby. · 5c54f63f
      Simon Riggs authored
      The machinery around XLOG_HEAP2_CLEANUP_INFO failed
      to correctly pass through the necessary information
      on latestRemovedXid, avoiding cancellations in some
      infrequent concurrent update/cleanup scenarios.
      
      Backpatchable fix to 9.0
      
      Detailed bug report and fix by Noah Misch,
      backpatchable version by me.
      5c54f63f
    • Bruce Momjian's avatar
      pg_upgrade: report failed cluster name · bd6aca8a
      Bruce Momjian authored
      When pg_upgrade can't find required pg_controldata information, report
      _which_ cluster is failing, with this message:
      
      	The %s cluster lacks some required control information:
      bd6aca8a
    • Heikki Linnakangas's avatar
      Also fix rotation of csvlog on Windows. · 168d3157
      Heikki Linnakangas authored
      Backpatch to 9.2, like the previous fix.
      168d3157
    • Simon Riggs's avatar
      Docs shouldn't say HOT Standby. · f64315c6
      Simon Riggs authored
      Not an acronym.
      
      Jeff Janes
      f64315c6
    • Tom Lane's avatar
      Fix failure to rotate postmaster log file for size reasons on Windows. · 8556869f
      Tom Lane authored
      When we eliminated "unnecessary" wakeups of the syslogger process, we
      broke size-based logfile rotation on Windows, because on that platform
      data transfer is done in a separate thread.  While non-Windows platforms
      would recheck the output file size after every log message, Windows only
      did so when the control thread woke up for some other reason, which might
      be quite infrequent.  Per bug #7814 from Tsunezumi.  Back-patch to 9.2
      where the problem was introduced.
      
      Jeff Janes
      8556869f
  7. 23 Jan, 2013 1 commit