1. 26 Mar, 2014 9 commits
    • Tom Lane's avatar
      Fix refcounting bug in PLy_modify_tuple(). · 2d5e0f07
      Tom Lane authored
      We must increment the refcount on "plntup" as soon as we have the
      reference, not sometime later.  Otherwise, if an error is thrown in
      between, the Py_XDECREF(plntup) call in the PG_CATCH block removes a
      refcount we didn't add, allowing the object to be freed even though
      it's still part of the plpython function's parsetree.
      
      This appears to be the cause of crashes seen on buildfarm member
      prairiedog.  It's a bit surprising that we've not seen it fail repeatably
      before, considering that the regression tests have been exercising the
      faulty code path since 2009.
      
      The real-world impact is probably minimal, since it's unlikely anyone would
      be provoking the "TD["new"] is not a dictionary" error in production, and
      that's the only case that is actually wrong.  Still, it's a bug affecting
      the regression tests, so patch all supported branches.
      
      In passing, remove dead variable "plstr", and demote "platt" to a local
      variable inside the PG_TRY block, since we don't need to clean it up
      in the PG_CATCH path.
      2d5e0f07
    • Heikki Linnakangas's avatar
      Pass more than the first XLogRecData entry to rm_desc, with WAL_DEBUG. · c2a67248
      Heikki Linnakangas authored
      If you compile with WAL_DEBUG and enable it with wal_debug=on, we used to
      only pass the first XLogRecData entry to the rm_desc routine. I think the
      original assumprion was that the first XLogRecData entry contains all the
      necessary information for the rm_desc routine, but that's a pretty shaky
      assumption. At least standby_redo didn't get the memo.
      
      To fix, piece together all the data in a temporary buffer, and pass that to
      the rm_desc routine.
      
      It's been like this forever, but the patch didn't apply cleanly to
      back-branches. Probably wouldn't be hard to fix the conflicts, but it's
      not worth the trouble.
      c2a67248
    • Bruce Momjian's avatar
      psql: update "replica identity" display for \d+ · b69c4e65
      Bruce Momjian authored
      Display "replica identity" only for \d plus mode, exclude system schema
      objects, and display all possible values, not just non-default,
      non-index ones.
      b69c4e65
    • Bruce Momjian's avatar
      ba08155b
    • Andrew Dunstan's avatar
      Cleanup around json_to_record/json_to_recordset · f9c6d72c
      Andrew Dunstan authored
      Set function parameter names and defaults. Add jsonb versions (which the
      code already provided for so the actual new code is trivial). Add jsonb
      regression tests and docs.
      
      Bump catalog version (which I apparently forgot to do when jsonb was
      committed).
      f9c6d72c
    • Heikki Linnakangas's avatar
      28475f8e
    • Heikki Linnakangas's avatar
      Add -f/--follow option to pg_xlogdump. · ce9bb92f
      Heikki Linnakangas authored
      This is useful for seeing what WAL records are inserted in real-time, by
      pointing pg_xlogdump to a live server.
      ce9bb92f
    • Heikki Linnakangas's avatar
      Fix 'recheck' flag in tsquery's GIN tri-consistent function. · 86cf41ed
      Heikki Linnakangas authored
      It needs to be initialized, like in the boolean gin_tsquery_consistent
      version.
      
      Peter Geoghegan.
      86cf41ed
    • Andrew Dunstan's avatar
      Tidy up the populate/to_record{set} code for json a bit. · fbc3def8
      Andrew Dunstan authored
      In the process fix a small bug.
      fbc3def8
  2. 25 Mar, 2014 3 commits
  3. 24 Mar, 2014 8 commits
  4. 23 Mar, 2014 6 commits
    • Andrew Dunstan's avatar
      Fix mis-spelling in jsonb docs. · ca07cd59
      Andrew Dunstan authored
      Per Thom Brown.
      ca07cd59
    • Andrew Dunstan's avatar
      Introduce jsonb, a structured format for storing json. · d9134d0a
      Andrew Dunstan authored
      The new format accepts exactly the same data as the json type. However, it is
      stored in a format that does not require reparsing the orgiginal text in order
      to process it, making it much more suitable for indexing and other operations.
      Insignificant whitespace is discarded, and the order of object keys is not
      preserved. Neither are duplicate object keys kept - the later value for a given
      key is the only one stored.
      
      The new type has all the functions and operators that the json type has,
      with the exception of the json generation functions (to_json, json_agg etc.)
      and with identical semantics. In addition, there are operator classes for
      hash and btree indexing, and two classes for GIN indexing, that have no
      equivalent in the json type.
      
      This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which
      was intended to provide similar facilities to a nested hstore type, but which
      in the end proved to have some significant compatibility issues.
      
      Authors: Oleg Bartunov,  Teodor Sigaev, Peter Geoghegan and Andrew Dunstan.
      Review: Andres Freund
      d9134d0a
    • Noah Misch's avatar
      Don't test xmin/xmax columns of a postgres_fdw foreign table. · b2b2491b
      Noah Misch authored
      Their values are unspecified and system-dependent.
      
      Per buildfarm member kouprey.
      b2b2491b
    • Noah Misch's avatar
      Offer triggers on foreign tables. · 7cbe57c3
      Noah Misch authored
      This covers all the SQL-standard trigger types supported for regular
      tables; it does not cover constraint triggers.  The approach for
      acquiring the old row mirrors that for view INSTEAD OF triggers.  For
      AFTER ROW triggers, we spool the foreign tuples to a tuplestore.
      
      This changes the FDW API contract; when deciding which columns to
      populate in the slot returned from data modification callbacks, writable
      FDWs will need to check for AFTER ROW triggers in addition to checking
      for a RETURNING clause.
      
      In support of the feature addition, refactor the TriggerFlags bits and
      the assembly of old tuples in ModifyTable.
      
      Ronan Dunklau, reviewed by KaiGai Kohei; some additional hacking by me.
      7cbe57c3
    • Noah Misch's avatar
    • Noah Misch's avatar
      Address ccvalid/ccnoinherit in TupleDesc support functions. · c31305de
      Noah Misch authored
      equalTupleDescs() neglected both of these ConstrCheck fields, and
      CreateTupleDescCopyConstr() neglected ccnoinherit.  At this time, the
      only known behavior defect resulting from these omissions is constraint
      exclusion disregarding a CHECK constraint validated by an ALTER TABLE
      VALIDATE CONSTRAINT statement issued earlier in the same transaction.
      Back-patch to 9.2, where these fields were introduced.
      c31305de
  5. 21 Mar, 2014 5 commits
  6. 20 Mar, 2014 3 commits
    • Tom Lane's avatar
      Again fix initialization of auto-tuned effective_cache_size. · af930e60
      Tom Lane authored
      The previous method was overly complex and underly correct; in particular,
      by assigning the default value with PGC_S_OVERRIDE, it prevented later
      attempts to change the setting in postgresql.conf, as noted by Jeff Janes.
      We should just assign the default value with source PGC_S_DYNAMIC_DEFAULT,
      which will have the desired priority relative to the boot_val as well as
      user-set values.
      
      There is still a gap in this method: if there's an explicit assignment of
      effective_cache_size = -1 in the postgresql.conf file, and that assignment
      appears before shared_buffers is assigned, the code will substitute 4 times
      the bootstrap default for shared_buffers, and that value will then persist
      (since it will have source PGC_S_FILE).  I don't see any very nice way
      to avoid that though, and it's not a case to be expected in practice.
      The existing comments in guc-file.l look forward to a redesign of the
      DYNAMIC_DEFAULT mechanism; if that ever happens, we should consider this
      case as one of the things we'd like to improve.
      af930e60
    • Bruce Momjian's avatar
      libpq: pass a memory allocation failure error up to PQconndefaults() · a4c8f143
      Bruce Momjian authored
      Previously user name memory allocation failures were ignored and the
      default user name set to NULL.
      a4c8f143
    • Robert Haas's avatar
      test_shm_mq: Improve regression tests. · d1bdab2f
      Robert Haas authored
      Per discussion with Tom Lane.
      d1bdab2f
  7. 19 Mar, 2014 3 commits
    • Alvaro Herrera's avatar
      Setup error context callback for transaction lock waits · f88d4cfc
      Alvaro Herrera authored
      With this in place, a session blocking behind another one because of
      tuple locks will get a context line mentioning the relation name, tuple
      TID, and operation being done on tuple.  For example:
      
      LOG:  process 11367 still waiting for ShareLock on transaction 717 after 1000.108 ms
      DETAIL:  Process holding the lock: 11366. Wait queue: 11367.
      CONTEXT:  while updating tuple (0,2) in relation "foo"
      STATEMENT:  UPDATE foo SET value = 3;
      
      Most usefully, the new line is displayed by log entries due to
      log_lock_waits, although of course it will be printed by any other log
      message as well.
      
      Author: Christian Kruse, some tweaks by Álvaro Herrera
      Reviewed-by: Amit Kapila, Andres Freund, Tom Lane, Robert Haas
      f88d4cfc
    • Tom Lane's avatar
      Fix memory leak during regular expression execution. · ea8c7e90
      Tom Lane authored
      For a regex containing backrefs, pg_regexec() might fail to free all the
      sub-DFAs that were created during execution, resulting in a permanent
      (session lifespan) memory leak.  Problem was introduced by me in commit
      58735947.  Per report from Sandro Santilli;
      diagnosis by Greg Stark.
      ea8c7e90
    • Fujii Masao's avatar
      Some minor improvements to logical decoding document. · fb1d92a9
      Fujii Masao authored
      Also improve help message in pg_recvlogical.
      fb1d92a9
  8. 18 Mar, 2014 3 commits