1. 14 3月, 2019 1 次提交
  2. 13 12月, 2018 1 次提交
    • D
      Reporting cleanup for GPDB specific errors/messages · 56540f11
      Daniel Gustafsson 提交于
      The Greenplum specific error handling via ereport()/elog() calls was
      in need of a unification effort as some parts of the code was using a
      different messaging style to others (and to upstream). This aims at
      bringing many of the GPDB error calls in line with the upstream error
      message writing guidelines and thus make the user experience of
      Greenplum more consistent.
      
      The main contributions of this patch are:
      
      * errmsg() messages shall start with a lowercase letter, and not end
        with a period. errhint() and errdetail() shall be complete sentences
        starting with capital letter and ending with a period. This attempts
        to fix this on as many ereport() calls as possible, with too detailed
        errmsg() content broken up into details and hints where possible.
      
      * Reindent ereport() calls to be more consistent with the common style
        used in upstream and most parts of Greenplum:
      
      	ereport(ERROR,
      			(errcode(<CODE>),
      			 errmsg("short message describing error"),
      			 errhint("Longer message as a complete sentence.")));
      
      * Avoid breaking messages due to long lines since it makes grepping
        for error messages harder when debugging. This is also the de facto
        standard in upstream code.
      
      * Convert a few internal error ereport() calls to elog(). There are
        no doubt more that can be converted, but the low hanging fruit has
        been dealt with. Also convert a few elog() calls which are user
        facing to ereport().
      
      * Update the testfiles to match the new messages.
      
      Spelling and wording is mostly left for a follow-up commit, as this was
      getting big enough as it was. The most obvious cases have been handled
      but there is work left to be done here.
      
      Discussion: https://github.com/greenplum-db/gpdb/pull/6378Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
      Reviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
      56540f11
  3. 24 9月, 2018 1 次提交
    • T
      Fix failure in WHERE CURRENT OF after rewinding the referenced cursor. · 38cb0108
      Tom Lane 提交于
      In a case where we have multiple relation-scan nodes in a cursor plan,
      such as a scan of an inheritance tree, it's possible to fetch from a
      given scan node, then rewind the cursor and fetch some row from an
      earlier scan node.  In such a case, execCurrent.c mistakenly thought
      that the later scan node was still active, because ExecReScan hadn't
      done anything to make it look not-active.  We'd get some sort of
      failure in the case of a SeqScan node, because the node's scan tuple
      slot would be pointing at a HeapTuple whose t_self gets reset to
      invalid by heapam.c.  But it seems possible that for other relation
      scan node types we'd actually return a valid tuple TID to the caller,
      resulting in updating or deleting a tuple that shouldn't have been
      considered current.  To fix, forcibly clear the ScanTupleSlot in
      ExecScanReScan.
      
      Another issue here, which seems only latent at the moment but could
      easily become a live bug in future, is that rewinding a cursor does
      not necessarily lead to *immediately* applying ExecReScan to every
      scan-level node in the plan tree.  Upper-level nodes will think that
      they can postpone that call if their child node is already marked
      with chgParam flags.  I don't see a way for that to happen today in
      a plan tree that's simple enough for execCurrent.c's search_plan_tree
      to understand, but that's one heck of a fragile assumption.  So, add
      some logic in search_plan_tree to detect chgParam flags being set on
      nodes that it descended to/through, and assume that that means we
      should consider lower scan nodes to be logically reset even if their
      ReScan call hasn't actually happened yet.
      
      Per bug #15395 from Matvey Arye.  This has been broken for a long time,
      so back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/153764171023.14986.280404050547008575@wrigleys.postgresql.org
      38cb0108
  4. 18 3月, 2018 1 次提交
    • T
      Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan. · 0a0721f8
      Tom Lane 提交于
      "UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error message
      like "cannot extract system attribute from virtual tuple", if the cursor
      was using a index-only scan for the target table.  Fix it by digging the
      current TID out of the indexscan state.
      
      It seems likely that the same failure could occur for CustomScan plans
      and perhaps some FDW plan types, so that leaving this to be treated as an
      internal error with an obscure message isn't as good an idea as it first
      seemed.  Hence, add a bit of heaptuple.c infrastructure to let us deliver
      a more on-topic message.  I chose to make the message match what you get
      for the case where execCurrentOf can't identify the target scan node at
      all, "cursor "foo" is not a simply updatable scan of table "bar"".
      Perhaps it should be different, but we can always adjust that later.
      
      In the future, it might be nice to provide hooks that would let custom
      scan providers and/or FDWs deal with this in other ways; but that's
      not a suitable topic for a back-patchable bug fix.
      
      It's been like this all along, so back-patch to all supported branches.
      
      Yugo Nagata and Tom Lane
      
      Discussion: https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp
      0a0721f8
  5. 22 2月, 2018 1 次提交
  6. 21 11月, 2017 1 次提交
    • H
      Remove unnecessary ORDER BYs from upstream tests. · cc6b462b
      Heikki Linnakangas 提交于
      These were added in GPDB a long time ago, probably before gpdiff.pl was
      introduced to mask row order differences in regression test output. But
      now that gpdiff.pl can do that, these are unnecessary. Revert to match
      the upstream more closely.
      
      This includes updates to the 'rules' and 'inherit' tests, although they
      are disabled and still doesn't pass after these changes.
      cc6b462b
  7. 15 5月, 2017 1 次提交
    • V
      Streamline Orca Gucs · 9f2c838b
      Venkatesh Raghavan 提交于
      * Enable analyzing root partitions
      * Ensure that the name of the guc is clear
      * Remove double negation (where possible)
      * Update comments
      * Co-locate gucs that have similar purpose
      * Remove dead gucs
      * Classify them correctly so that they are no longer hidden
      9f2c838b
  8. 29 8月, 2016 1 次提交
  9. 28 10月, 2015 1 次提交
  10. 08 5月, 2014 1 次提交
    • T
      Fix failure to set ActiveSnapshot while rewinding a cursor. · 04e5025b
      Tom Lane 提交于
      ActiveSnapshot needs to be set when we call ExecutorRewind because some
      plan node types may execute user-defined functions during their ReScan
      calls (nodeLimit.c does so, at least).  The wisdom of that is somewhat
      debatable, perhaps, but for now the simplest fix is to make sure the
      required context is valid.  Failure to do this typically led to a
      null-pointer-dereference core dump, though it's possible that in more
      complex cases a function could be executed with the wrong snapshot
      leading to very subtle misbehavior.
      
      Per report from Leif Jensen.  It's been broken for a long time, so
      back-patch to all active branches.
      04e5025b
  11. 03 8月, 2013 1 次提交
    • A
      Fix crash in error report of invalid tuple lock · 88c55668
      Alvaro Herrera 提交于
      My tweak of these error messages in commit c359a1b0 contained the
      thinko that a query would always have rowMarks set for a query
      containing a locking clause.  Not so: when declaring a cursor, for
      instance, rowMarks isn't set at the point we're checking, so we'd be
      dereferencing a NULL pointer.
      
      The fix is to pass the lock strength to the function raising the error,
      instead of trying to reverse-engineer it.  The result not only is more
      robust, but it also seems cleaner overall.
      
      Per report from Robert Haas.
      88c55668
  12. 24 11月, 2010 1 次提交
  13. 03 10月, 2009 1 次提交
    • A
      Ensure that a cursor has an immutable snapshot throughout its lifespan. · caa4cfa3
      Alvaro Herrera 提交于
      The old coding was using a regular snapshot, referenced elsewhere, that was
      subject to having its command counter updated.  Fix by creating a private copy
      of the snapshot exclusively for the cursor.
      
      Backpatch to 8.4, which is when the bug was introduced during the snapshot
      management rewrite.
      caa4cfa3
  14. 27 1月, 2009 1 次提交
  15. 23 1月, 2009 1 次提交
  16. 17 11月, 2008 1 次提交
    • T
      Modify UPDATE/DELETE WHERE CURRENT OF to use the FOR UPDATE infrastructure to · 18004101
      Tom Lane 提交于
      locate the target row, if the cursor was declared with FOR UPDATE or FOR
      SHARE.  This approach is more flexible and reliable than digging through the
      plan tree; for instance it can cope with join cursors.  But we still provide
      the old code for use with non-FOR-UPDATE cursors.  Per gripe from Robert Haas.
      18004101
  17. 16 11月, 2008 1 次提交
    • T
      Make SELECT FOR UPDATE/SHARE work on inheritance trees, by having the plan · 0656ed3d
      Tom Lane 提交于
      return the tableoid as well as the ctid for any FOR UPDATE targets that
      have child tables.  All child tables are listed in the ExecRowMark list,
      but the executor just skips the ones that didn't produce the current row.
      
      Curiously, this longstanding restriction doesn't seem to have been documented
      anywhere; so no doc changes.
      0656ed3d
  18. 07 4月, 2008 1 次提交
    • T
      Improve hash_any() to use word-wide fetches when hashing suitably aligned · 26043592
      Tom Lane 提交于
      data.  This makes for a significant speedup at the cost that the results
      now vary between little-endian and big-endian machines; which forces us
      to add explicit ORDER BYs in a couple of regression tests to preserve
      machine-independent comparison results.  Also, force initdb by bumping
      catversion, since the contents of hash indexes will change (at least on
      big-endian machines).
      
      Kenneth Marshall and Tom Lane, based on work from Bob Jenkins.  This commit
      does not adopt Bob's new faster mix() algorithm, however, since we still need
      to convince ourselves that that doesn't degrade the quality of the hashing.
      26043592
  19. 25 10月, 2007 2 次提交
    • T
      Disallow scrolling of FOR UPDATE/FOR SHARE cursors, so as to avoid problems · 048efc25
      Tom Lane 提交于
      in corner cases such as re-fetching a just-deleted row.  We may be able to
      relax this someday, but let's find out how many people really care before
      we invest a lot of work in it.  Per report from Heikki and subsequent
      discussion.
      
      While in the neighborhood, make the combination of INSENSITIVE and FOR UPDATE
      throw an error, since they are semantically incompatible.  (Up to now we've
      accepted but just ignored the INSENSITIVE option of DECLARE CURSOR.)
      048efc25
    • T
      Fix UPDATE/DELETE WHERE CURRENT OF to support repeated update and update- · c29a9c37
      Tom Lane 提交于
      then-delete on the current cursor row.  The basic fix is that nodeTidscan.c
      has to apply heap_get_latest_tid() to the current-scan-TID obtained from the
      cursor query; this ensures we get the latest row version to work with.
      However, since that only works if the query plan is a TID scan, we also have
      to hack the planner to make sure only that type of plan will be selected.
      (Formerly, the planner might decide to apply a seqscan if the table is very
      small.  This change is probably a Good Thing anyway, since it's hard to see
      how a seqscan could really win.)  That means the execQual.c code to support
      CurrentOfExpr as a regular expression type is dead code, so replace it with
      just an elog().  Also, add regression tests covering these cases.  Note
      that the added tests expose the fact that re-fetching an updated row
      misbehaves if the cursor used FOR UPDATE.  That's an independent bug that
      should be fixed later.  Per report from Dharmendra Goyal.
      c29a9c37
  20. 11 6月, 2007 1 次提交
    • T
      Support UPDATE/DELETE WHERE CURRENT OF cursor_name, per SQL standard. · 6808f1b1
      Tom Lane 提交于
      Along the way, allow FOR UPDATE in non-WITH-HOLD cursors; there may once
      have been a reason to disallow that, but it seems to work now, and it's
      really rather necessary if you want to select a row via a cursor and then
      update it in a concurrent-safe fashion.
      
      Original patch by Arul Shaji, rather heavily editorialized by Tom Lane.
      6808f1b1
  21. 10 6月, 2007 1 次提交
  22. 12 4月, 2007 1 次提交
    • N
      RESET SESSION, plus related new DDL commands. Patch from Marko Kreen, · d13e903b
      Neil Conway 提交于
      reviewed by Neil Conway. This patch adds the following DDL command
      variants: RESET SESSION, RESET TEMP, RESET PLANS, CLOSE ALL, and
      DEALLOCATE ALL. RESET SESSION is intended for use by connection
      pool software and the like, in order to reset a client session
      to something close to its initial state.
      
      Note that while most of these command variants can be executed
      inside a transaction block (but are not transaction-aware!),
      RESET SESSION cannot. While this is inconsistent, it is intended
      to catch programmer mistakes: RESET SESSION in an open transaction
      block is probably unintended.
      d13e903b
  23. 28 2月, 2006 1 次提交
  24. 18 1月, 2006 1 次提交
    • N
      Add a new system view, pg_cursors, that displays the currently available · 33e06ebc
      Neil Conway 提交于
      cursors. Patch from Joachim Wieland, review and ediorialization by Neil
      Conway. The view lists cursors defined by DECLARE CURSOR, using SPI, or
      via the Bind message of the frontend/backend protocol. This means the
      view does not list the unnamed portal or the portal created to implement
      EXECUTE. Because we do list SPI portals, there might be more rows in
      this view than you might expect if you are using SPI implicitly (e.g.
      via a procedural language).
      
      Per recent discussion on -hackers, the query string included in the
      view for cursors defined by DECLARE CURSOR is based on
      debug_query_string. That means it is not accurate if multiple queries
      separated by semicolons are submitted as one query string. However,
      there doesn't seem a trivial fix for that: debug_query_string
      is better than nothing. I also changed SPI_cursor_open() to include
      the source text for the portal it creates: AFAICS there is no reason
      not to do this.
      
      Update the documentation and regression tests, bump the catversion.
      33e06ebc
  25. 12 4月, 2005 1 次提交
  26. 02 8月, 2004 1 次提交
    • T
      Allow DECLARE CURSOR to take parameters from the portal in which it is · f622c540
      Tom Lane 提交于
      executed.  Previously, the DECLARE would succeed but subsequent FETCHes
      would fail since the parameter values supplied to DECLARE were not
      propagated to the portal created for the cursor.
      In support of this, add type Oids to ParamListInfo entries, which seems
      like a good idea anyway since code that extracts a value can double-check
      that it got the type of value it was expecting.
      Oliver Jowett, with minor editorialization by Tom Lane.
      f622c540
  27. 25 8月, 2003 1 次提交
  28. 23 7月, 2003 1 次提交
  29. 21 7月, 2003 1 次提交
  30. 29 4月, 2003 1 次提交
  31. 28 3月, 2003 1 次提交
    • B
      This patch implements holdable cursors, following the proposal · 54f7338f
      Bruce Momjian 提交于
      (materialization into a tuple store) discussed on pgsql-hackers earlier.
      I've updated the documentation and the regression tests.
      
      Notes on the implementation:
      
      - I needed to change the tuple store API slightly -- it assumes that it
      won't be used to hold data across transaction boundaries, so the temp
      files that it uses for on-disk storage are automatically reclaimed at
      end-of-transaction. I added a flag to tuplestore_begin_heap() to control
      this behavior. Is changing the tuple store API in this fashion OK?
      
      - in order to store executor results in a tuple store, I added a new
      CommandDest. This works well for the most part, with one exception: the
      current DestFunction API doesn't provide enough information to allow the
      Executor to store results into an arbitrary tuple store (where the
      particular tuple store to use is chosen by the call site of
      ExecutorRun). To workaround this, I've temporarily hacked up a solution
      that works, but is not ideal: since the receiveTuple DestFunction is
      passed the portal name, we can use that to lookup the Portal data
      structure for the cursor and then use that to get at the tuple store the
      Portal is using. This unnecessarily ties the Portal code with the
      tupleReceiver code, but it works...
      
      The proper fix for this is probably to change the DestFunction API --
      Tom suggested passing the full QueryDesc to the receiveTuple function.
      In that case, callers of ExecutorRun could "subclass" QueryDesc to add
      any additional fields that their particular CommandDest needed to get
      access to. This approach would work, but I'd like to think about it for
      a little bit longer before deciding which route to go. In the mean time,
      the code works fine, so I don't think a fix is urgent.
      
      - (semi-related) I added a NO SCROLL keyword to DECLARE CURSOR, and
      adjusted the behavior of SCROLL in accordance with the discussion on
      -hackers.
      
      - (unrelated) Cleaned up some SGML markup in sql.sgml, copy.sgml
      
      Neil Conway
      54f7338f
  32. 09 1月, 2000 1 次提交
  33. 29 4月, 1997 1 次提交