Skip to content
Snippets Groups Projects
  1. May 24, 2012
  2. May 23, 2012
  3. May 22, 2012
    • Robert Haas's avatar
      Fix error message for COMMENT/SECURITY LABEL ON COLUMN xxx IS 'yyy' · 8fbe5a31
      Robert Haas authored
      When the column name is an unqualified name, rather than table.column,
      the error message complains about too many dotted names, which is
      wrong.  Report by Peter Eisentraut based on examination of the
      sepgsql regression test output, but the problem also affects COMMENT.
      New wording as suggested by Tom Lane.
      8fbe5a31
  4. May 20, 2012
  5. May 17, 2012
  6. May 15, 2012
  7. May 11, 2012
    • Tom Lane's avatar
      Fix contrib/citext's upgrade script to handle array and domain cases. · 63fecc91
      Tom Lane authored
      We previously recognized that citext wouldn't get marked as collatable
      during pg_upgrade from a pre-9.1 installation, and hacked its
      create-from-unpackaged script to manually perform the necessary catalog
      adjustments.  However, we overlooked the fact that domains over citext,
      as well as the citext[] array type, need the same adjustments.  Extend
      the script to handle those cases.
      
      Also, the documentation suggested that this was only an issue in pg_upgrade
      scenarios, which is quite wrong; loading any dump containing citext from a
      pre-9.1 server will also result in the type being wrongly marked.
      
      I approached the documentation problem by changing the 9.1.2 release note
      paragraphs about this issue, which is historically inaccurate.  But it
      seems better than having the information scattered in multiple places, and
      leaving incorrect info in the 9.1.2 notes would be bad anyway.  We'll still
      need to mention the issue again in the 9.1.4 notes, but perhaps they can
      just reference 9.1.2 for fix instructions.
      
      Per report from Evan Carroll.  Back-patch into 9.1.
      63fecc91
  8. May 08, 2012
  9. May 02, 2012
  10. Apr 30, 2012
  11. Apr 28, 2012
    • Tom Lane's avatar
      Adjust timing units in pg_stat_statements. · 93f94e35
      Tom Lane authored
      Display total time and I/O timings in milliseconds, for consistency with
      the units used for timings in the core statistics views.  The columns
      remain of float8 type, so that sub-msec precision is available.  (At some
      point we will probably want to convert the core views to use float8 type
      for the same reason, but this patch does not touch that issue.)
      
      This is a release-note-requiring change in the meaning of the total_time
      column.  The I/O timing columns are new as of 9.2, so there is no
      compatibility impact from redefining them.
      
      Do some minor copy-editing in the documentation, too.
      93f94e35
  12. Apr 24, 2012
  13. Apr 22, 2012
  14. Apr 19, 2012
    • Tom Lane's avatar
      Revise parameterized-path mechanism to fix assorted issues. · 5b7b5518
      Tom Lane authored
      This patch adjusts the treatment of parameterized paths so that all paths
      with the same parameterization (same set of required outer rels) for the
      same relation will have the same rowcount estimate.  We cache the rowcount
      estimates to ensure that property, and hopefully save a few cycles too.
      Doing this makes it practical for add_path_precheck to operate without
      a rowcount estimate: it need only assume that paths with different
      parameterizations never dominate each other, which is close enough to
      true anyway for coarse filtering, because normally a more-parameterized
      path should yield fewer rows thanks to having more join clauses to apply.
      
      In add_path, we do the full nine yards of comparing rowcount estimates
      along with everything else, so that we can discard parameterized paths that
      don't actually have an advantage.  This fixes some issues I'd found with
      add_path rejecting parameterized paths on the grounds that they were more
      expensive than not-parameterized ones, even though they yielded many fewer
      rows and hence would be cheaper once subsequent joining was considered.
      
      To make the same-rowcounts assumption valid, we have to require that any
      parameterized path enforce *all* join clauses that could be obtained from
      the particular set of outer rels, even if not all of them are useful for
      indexing.  This is required at both base scans and joins.  It's a good
      thing anyway since the net impact is that join quals are checked at the
      lowest practical level in the join tree.  Hence, discard the original
      rather ad-hoc mechanism for choosing parameterization joinquals, and build
      a better one that has a more principled rule for when clauses can be moved.
      The original rule was actually buggy anyway for lack of knowledge about
      which relations are part of an outer join's outer side; getting this right
      requires adding an outer_relids field to RestrictInfo.
      5b7b5518
  15. Apr 14, 2012
    • Peter Eisentraut's avatar
      Update contrib/README · 48ea5583
      Peter Eisentraut authored
      Remove lots of outdated information that is duplicated by the
      better-maintained SGML documentation.  In particular, remove the
      outdated listing of contrib modules.  Update the installation
      instructions to mention CREATE EXTENSION, but don't go into too much
      detail.
      48ea5583
  16. Apr 11, 2012
  17. Apr 09, 2012
    • Tom Lane's avatar
      Save a few cycles while creating "sticky" entries in pg_stat_statements. · e969f9a7
      Tom Lane authored
      There's no need to sit there and increment the stats when we know all the
      increments would be zero anyway.  The actual additions might not be very
      expensive, but skipping acquisition of the spinlock seems like a good
      thing.  Pushing the logic about initialization of the usage count down into
      entry_alloc() allows us to do that while making the code actually simpler,
      not more complex.  Expansion on a suggestion by Peter Geoghegan.
      e969f9a7
  18. Apr 08, 2012
    • Tom Lane's avatar
      Improve management of "sticky" entries in contrib/pg_stat_statements. · d5375491
      Tom Lane authored
      This patch addresses a deficiency in the previous pg_stat_statements patch.
      We want to give sticky entries an initial "usage" factor high enough that
      they probably will stick around until their query is completed.  However,
      if the query never completes (eg it gets an error during execution), the
      entry shouldn't persist indefinitely.  Manage this by starting out with
      a usage setting equal to the (approximate) median usage value within the
      whole hashtable, but decaying the value much more aggressively than we
      do for normal entries.
      
      Peter Geoghegan
      d5375491
  19. Apr 06, 2012
    • Tom Lane's avatar
      Dept of second thoughts: improve the API for AnalyzeForeignTable. · cea49fe8
      Tom Lane authored
      If we make the initially-called function return the table physical-size
      estimate, acquire_inherited_sample_rows will be able to use that to
      allocate numbers of samples among child tables, when the day comes that
      we want to support foreign tables in inheritance trees.
      cea49fe8
    • Tom Lane's avatar
      Allow statistics to be collected for foreign tables. · 263d9de6
      Tom Lane authored
      ANALYZE now accepts foreign tables and allows the table's FDW to control
      how the sample rows are collected.  (But only manual ANALYZEs will touch
      foreign tables, for the moment, since among other things it's not very
      clear how to handle remote permissions checks in an auto-analyze.)
      
      contrib/file_fdw is extended to support this.
      
      Etsuro Fujita, reviewed by Shigeru Hanada, some further tweaking by me.
      263d9de6
  20. 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
  21. 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
  22. Mar 30, 2012
  23. 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
  24. Mar 27, 2012
  25. 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
  26. Mar 20, 2012
  27. Mar 19, 2012
  28. Mar 17, 2012
  29. Mar 16, 2012
  30. Mar 15, 2012
    • Robert Haas's avatar
      sepgsql_setcon(). · 523176cb
      Robert Haas authored
      This is intended as infrastructure to allow sepgsql to cooperate with
      connection pooling software, by allowing the effective security label
      to be set for each new connection.
      
      KaiGai Kohei, reviewed by Yeb Havinga.
      523176cb
Loading