Skip to content
Snippets Groups Projects
  1. Apr 05, 2012
    • Robert Haas's avatar
      Allow pg_archivecleanup to strip optional file extensions. · bbc02243
      Robert Haas authored
      Greg Smith and Jaime Casanova, reviewed by Alex Shulgin and myself.
      e
      bbc02243
    • Tom Lane's avatar
      Improve efficiency of dblink by using libpq's new row processor API. · 6f922ef8
      Tom Lane authored
      This patch provides a test case for libpq's row processor API.
      contrib/dblink can deal with very large result sets by dumping them into
      a tuplestore (which can spill to disk) --- but until now, the intermediate
      storage of the query result in a PGresult meant memory bloat for any large
      result.  Now we use a row processor to convert the data to tuple form and
      dump it directly into the tuplestore.
      
      A limitation is that this only works for plain dblink() queries, not
      dblink_send_query() followed by dblink_get_result().  In the latter
      case we don't know the desired tuple rowtype soon enough.  While hack
      solutions to that are possible, a different user-level API would
      probably be a better answer.
      
      Kyotaro Horiguchi, reviewed by Marko Kreen and Tom Lane
      6f922ef8
  2. Apr 04, 2012
    • Tom Lane's avatar
      Fix a couple of contrib/dblink bugs. · d843ed21
      Tom Lane authored
      dblink_exec leaked temporary database connections if any error occurred
      after connection setup, for example
      	SELECT dblink_exec('...connect string...', 'select 1/0');
      Add a PG_TRY block to ensure PQfinish gets done when it is needed.
      (dblink_record_internal is on the hairy edge of needing similar treatment,
      but seems not to be actively broken at the moment.)
      
      Also, in 9.0 and up, only one of the three functions using tuplestore
      return mode was properly checking that the query context would allow
      a tuplestore result.
      
      Noted while reviewing dblink patch.  Back-patch to all supported branches.
      d843ed21
  3. Mar 30, 2012
  4. Mar 29, 2012
    • Tom Lane's avatar
      Fix dblink's failure to report correct connection name in error messages. · b75fbe91
      Tom Lane authored
      The DBLINK_GET_CONN and DBLINK_GET_NAMED_CONN macros did not set the
      surrounding function's conname variable, causing errors to be incorrectly
      reported as having occurred on the "unnamed" connection in some cases.
      This bug was actually visible in two cases in the regression tests,
      but apparently whoever added those cases wasn't paying attention.
      
      Noted by Kyotaro Horiguchi, though this is different from his proposed
      patch.
      
      Back-patch to 8.4; 8.3 does not have the same type of error reporting
      so the patch is not relevant.
      b75fbe91
    • Tom Lane's avatar
      Improve contrib/pg_stat_statements' handling of PREPARE/EXECUTE statements. · 566a1d43
      Tom Lane authored
      It's actually more useful for the module to ignore these.  Ignoring
      EXECUTE (and not incrementing the nesting level) allows the executor
      hooks to charge the time to the underlying prepared query, which
      shows up as a stats entry with the original PREPARE as query string
      (possibly modified by suppression of constants, which might not be
      terribly useful here but it's not worth avoiding).  This is much more
      useful than cluttering the stats table with a distinct entry for each
      textually distinct EXECUTE.
      
      Experimentation with this idea shows that it's also preferable to ignore
      PREPARE.  If we don't, we get two stats table entries, one with the query
      string hash and one with the jumble-derived hash, but with the same visible
      query string (modulo those constants).  This is confusing and not very
      helpful, since the first entry will only receive costs associated with
      initial planning of the query, which is not something counted at all
      normally by pg_stat_statements.  (And if we do start tracking planning
      costs, we'd want them blamed on the other hash table entry anyway.)
      566a1d43
    • Tom Lane's avatar
      Improve handling of utility statements containing plannable statements. · e0e4ebe3
      Tom Lane authored
      When tracking nested statements, contrib/pg_stat_statements formerly
      double-counted the execution costs of utility statements that directly
      contain an executable statement, such as EXPLAIN and DECLARE CURSOR.
      This was not obvious since the ProcessUtility and Executor hooks
      would each add their measured costs to the same stats table entry.
      However, with the new implementation that hashes utility and plannable
      statements differently, this showed up as seemingly-duplicate stats
      entries.  Fix that by disabling the Executor hooks when the query has a
      queryId of zero, which was the case already for such statements but is now
      more clearly specified in the code.  (The zero queryId was causing problems
      anyway because all such statements would add to a single bogus entry.)
      
      The PREPARE/EXECUTE case still results in counting the same execution
      in two different stats table entries, but it should be much less surprising
      to users that there are two entries in such cases.
      
      In passing, include a CommonTableExpr's ctename in the query hash.
      I had left it out originally on the grounds that we wanted to omit all
      inessential aliases, but since RTE_CTE RTEs are hashing their referenced
      names, we'd better hash the CTE names too to make sure we don't hash
      semantically different queries the same.
      e0e4ebe3
    • Tom Lane's avatar
      Improve contrib/pg_stat_statements to lump "similar" queries together. · 7313cc01
      Tom Lane authored
      pg_stat_statements now hashes selected fields of the analyzed parse tree
      to assign a "fingerprint" to each query, and groups all queries with the
      same fingerprint into a single entry in the pg_stat_statements view.
      In practice it is expected that queries with the same fingerprint will be
      equivalent except for values of literal constants.  To make the display
      more useful, such constants are replaced by "?" in the displayed query
      strings.
      
      This mechanism currently supports only optimizable queries (SELECT,
      INSERT, UPDATE, DELETE).  Utility commands are still matched on the
      basis of their literal query strings.
      
      There remain some open questions about how to deal with utility statements
      that contain optimizable queries (such as EXPLAIN and SELECT INTO) and how
      to deal with expiring speculative hashtable entries that are made to save
      the normalized form of a query string.  However, fixing these issues should
      require only localized changes, and since there are other open patches
      involving contrib/pg_stat_statements, it seems best to go ahead and commit
      what we've got.
      
      Peter Geoghegan, reviewed by Daniel Farina
      7313cc01
  5. Mar 27, 2012
  6. Mar 21, 2012
    • Tom Lane's avatar
      Improve the -l (limit) option recently added to contrib/vacuumlo. · 64c60489
      Tom Lane authored
      Instead of just stopping after removing an arbitrary subset of orphaned
      large objects, commit and start a new transaction after each -l objects.
      This is just as effective as the original patch at limiting the number of
      locks used, and it doesn't require doing the OID collection process
      repeatedly to get everything.  Since the option no longer changes the
      fundamental behavior of vacuumlo, and it avoids a known server-side
      limitation, enable it by default (with a default limit of 1000 LOs per
      transaction).
      
      In passing, be more careful about properly quoting the names of tables
      and fields, and do some other cosmetic cleanup.
      64c60489
  7. Mar 20, 2012
  8. Mar 19, 2012
  9. Mar 17, 2012
  10. Mar 16, 2012
  11. Mar 15, 2012
  12. Mar 13, 2012
    • Robert Haas's avatar
      pgstattuple: Use a BufferAccessStrategy object to avoid cache-trashing. · 2e46bf67
      Robert Haas authored
      Jaime Casanova, reviewed by Noah Misch, slightly modified by me.
      2e46bf67
    • Robert Haas's avatar
      pgstattuple: Add new error case for spgist indexes. · 97c85098
      Robert Haas authored
      Extracted from a larger patch by Jaime Casanova, reviewed by Noah Misch.
      I think this error message could use some more extensive revision, but
      this at least makes the handling of spgist consistent with what we do for
      other types of indexes that this code doesn't know how to handle.
      97c85098
    • Bruce Momjian's avatar
      In pg_upgrade, add various logging improvements: · 717f6d60
      Bruce Momjian authored
      	add ability to control permissions of created files
      	have psql echo its queries for easier debugging
      	output four separate log files, and delete them on success
      	add -r/--retain option to keep log files after success
      	make logs file append-only
      	remove -g/-G/-l logging options
      	sugggest tailing appropriate log file on failure
      	enhance -v/--verbose behavior
      717f6d60
  13. Mar 09, 2012
    • Robert Haas's avatar
      sepgsql DROP support. · e914a144
      Robert Haas authored
      KaiGai Kohei
      e914a144
    • Tom Lane's avatar
      Revise FDW planning API, again. · b1495393
      Tom Lane authored
      Further reflection shows that a single callback isn't very workable if we
      desire to let FDWs generate multiple Paths, because that forces the FDW to
      do all work necessary to generate a valid Plan node for each Path.  Instead
      split the former PlanForeignScan API into three steps: GetForeignRelSize,
      GetForeignPaths, GetForeignPlan.  We had already bit the bullet of breaking
      the 9.1 FDW API for 9.2, so this shouldn't cause very much additional pain,
      and it's substantially more flexible for complex FDWs.
      
      Add an fdw_private field to RelOptInfo so that the new functions can save
      state there rather than possibly having to recalculate information two or
      three times.
      
      In addition, we'd not thought through what would be needed to allow an FDW
      to set up subexpressions of its choice for runtime execution.  We could
      treat ForeignScan.fdw_private as an executable expression but that seems
      likely to break existing FDWs unnecessarily (in particular, it would
      restrict the set of node types allowable in fdw_private to those supported
      by expression_tree_walker).  Instead, invent a separate field fdw_exprs
      which will receive the postprocessing appropriate for expression trees.
      (One field is enough since it can be a list of expressions; also, we assume
      the corresponding expression state tree(s) will be held within fdw_state,
      so we don't need to add anything to ForeignScanState.)
      
      Per review of Hanada Shigeru's pgsql_fdw patch.  We may need to tweak this
      further as we continue to work on that patch, but to me it feels a lot
      closer to being right now.
      b1495393
  14. Mar 08, 2012
    • Tom Lane's avatar
      Add GetForeignColumnOptions() to foreign.c, and add some documentation. · 9088d1b9
      Tom Lane authored
      GetForeignColumnOptions provides some abstraction for accessing
      column-specific FDW options, on a par with the access functions that were
      already provided here for other FDW-related information.
      
      Adjust file_fdw.c to use GetForeignColumnOptions instead of equivalent
      hand-rolled code.
      
      In addition, add some SGML documentation for the functions exported by
      foreign.c that are meant for use by FDW authors.
      
      (This is the fdw_helper portion of the proposed pgsql_fdw patch.)
      
      Hanada Shigeru, reviewed by KaiGai Kohei
      9088d1b9
  15. Mar 06, 2012
  16. Mar 05, 2012
    • Tom Lane's avatar
      Redesign PlanForeignScan API to allow multiple paths for a foreign table. · 6b289942
      Tom Lane authored
      The original API specification only allowed an FDW to create a single
      access path, which doesn't seem like a terribly good idea in hindsight.
      Instead, move the responsibility for building the Path node and calling
      add_path() into the FDW's PlanForeignScan function.  Now, it can do that
      more than once if appropriate.  There is no longer any need for the
      transient FdwPlan struct, so get rid of that.
      
      Etsuro Fujita, Shigeru Hanada, Tom Lane
      6b289942
  17. Feb 28, 2012
  18. Feb 23, 2012
  19. Feb 17, 2012
    • Tom Lane's avatar
      Fix longstanding error in contrib/intarray's int[] & int[] operator. · 06d9afa6
      Tom Lane authored
      The array intersection code would give wrong results if the first entry of
      the correct output array would be "1".  (I think only this value could be
      at risk, since the previous word would always be a lower-bound entry with
      that fixed value.)
      
      Problem spotted by Julien Rouhaud, initial patch by Guillaume Lelarge,
      cosmetic improvements by me.
      06d9afa6
  20. Feb 15, 2012
  21. Feb 14, 2012
  22. Feb 13, 2012
  23. Feb 07, 2012
Loading