1. 20 8月, 2016 1 次提交
  2. 16 8月, 2016 1 次提交
  3. 06 6月, 2016 1 次提交
    • H
      Backport b153c092 from PostgreSQL 8.4 · 78b0a42e
      Heikki Linnakangas 提交于
      This is a partial backport of a larger body of work which also already have
      been partially backported.
      
      Remove the GPDB-specific "breadcrumbs" mechanism from the parser. It is
      made obsolete by the upstream mechanism. We lose context information from
      a few errors, which is unfortunate, but seems acceptable. Upstream doesn't
      have context information for those errors either.
      
      The backport was originally done by Daniel Gustafsson, on top of the
      PostgreSQL 8.3 merge. I tweaked it to apply it to master, before the
      merge.
      
      Upstream commit:
      
        commit b153c092
        Author: Tom Lane <tgl@sss.pgh.pa.us>
        Date:   Mon Sep 1 20:42:46 2008 +0000
      
          Add a bunch of new error location reports to parse-analysis error messages.
          There are still some weak spots around JOIN USING and relation alias lists,
          but most errors reported within backend/parser/ now have locations.
      78b0a42e
  4. 14 4月, 2016 1 次提交
  5. 02 4月, 2016 1 次提交
    • H
      Support casts to/from string types for every datatype · d481bd72
      Haozhou Wang 提交于
      Backport below commits from upstream:
      
          commit 31edbadf
          Author: Tom Lane <tgl@sss.pgh.pa.us>
          Date:   Tue Jun 5 21:31:09 2007 +0000
      
              Downgrade implicit casts to text to be assignment-only, except for the ones
              from the other string-category types; this eliminates a lot of surprising
              interpretations that the parser could formerly make when there was no directly
              applicable operator.
      
              Create a general mechanism that supports casts to and from the standard string
              types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's
              I/O functions.  These new casts are assignment-only in the to-string direction,
              explicit-only in the other, and therefore should create no surprising behavior.
              Remove a bunch of thereby-obsoleted datatype-specific casting functions.
      
              The "general mechanism" is a new expression node type CoerceViaIO that can
              actually convert between *any* two datatypes if their external text
              representations are compatible.  This is more general than needed for the
              immediate feature, but might be useful in plpgsql or other places in future.
      
              This commit does nothing about the issue that applying the concatenation
              operator || to non-text types will now fail, often with strange error messages
              due to misinterpreting the operator as array concatenation.  Since it often
              (not always) worked before, we should either make it succeed or at least give
              a more user-friendly error; but details are still under debate.
      
              Peter Eisentraut and Tom Lane
      
          commit bf940763
          Author: Tom Lane <tgl@sss.pgh.pa.us>
          Date:   Tue Mar 27 23:21:12 2007 +0000
      
              Fix array coercion expressions to ensure that the correct volatility is
              seen by code inspecting the expression.  The best way to do this seems
              to be to drop the original representation as a function invocation, and
              instead make a special expression node type that represents applying
              the element-type coercion function to each array element.  In this way
              the element function is exposed and will be checked for volatility.
              Per report from Guillaume Smet.
      d481bd72
  6. 26 1月, 2016 1 次提交
    • K
      DEFAULT paramters of UDF ported from PostgreSQL 8.4 · 5b2af3cf
      Kuien Liu 提交于
      Functions can be declared with parameters with default values or
      expressions.  The default expressions are used as parameter value
      if the parameter is not explicitly specified in a function call.
      All parameters after a parameter with default value have to be
      parameters with default values as well.
      
      It allows user to invoke a UDF without setting all the parameters.
      Two examples to demo its usage:
      
          CREATE FUNCTION dfunc1(text DEFAULT 'Hello', text DEFAULT 'World')
              RETURNS text AS $$
              SELECT $1 || ', ' || $2;
              $$ LANGUAGE SQL;
          SELECT dfunc1();  -- 'Hello, World'
          SELECT dfunc1('Hi');  -- 'Hi, World'
          SELECT dfunc1('Hi', 'Beijing');  -- 'Hi, Beijing'
      
          CREATE FUNCTION dfunc2(id int4, t timestamp DEFAULT now())
              RETURNS text AS $$
              SELECT 'Time for id:' || $1 || ' is ' || $2;
              $$ LANGUAGE SQL;
          SELECT dfunc2(24);  -- 'Time for id:24 is 2016-01-07 14:38'
      
      NOTE: The default change set is ported from from PostgreSQL 8.4,
          original commits:
          '517ae403'
          '455dffbb'
      5b2af3cf
  7. 28 10月, 2015 1 次提交
  8. 15 12月, 2008 1 次提交
    • T
      Restore enforce_generic_type_consistency's pre-8.3 behavior of allowing an · 4d2fa58a
      Tom Lane 提交于
      actual argument type of ANYARRAY to match an argument declared ANYARRAY,
      so long as ANYELEMENT etc aren't used.  I had overlooked the fact that this
      is a possible case while fixing bug #3852; but it is possible because
      pg_statistic contains columns declared ANYARRAY.  Per gripe from Corey Horton.
      4d2fa58a
  9. 26 10月, 2008 1 次提交
    • T
      Add a heuristic to transformAExprIn() to make it prefer expanding "x IN (list)" · 6571729d
      Tom Lane 提交于
      into an OR of equality comparisons, rather than x = ANY(ARRAY[...]), when there
      are Vars in the right-hand side.  This avoids a performance regression compared
      to pre-8.2 releases, in cases where the OR form can be optimized into scans
      of multiple indexes.  Limit the possible downside by preferring this form only
      when the list isn't very long (I set the cutoff at 32 elements, which is a
      bit arbitrary but in the right ballpark).  Per discussion with Jim Nasby.
      
      In passing, also make it try the OR form if it cannot select a common type
      for the array elements; we've seen a complaint or two about how the OR form
      worked for such cases and ARRAY doesn't.
      6571729d
  10. 12 1月, 2008 1 次提交
  11. 02 1月, 2008 1 次提交
  12. 27 11月, 2007 1 次提交
    • T
      Fix select_common_type() so that it can select a domain type, if all inputs · 07daff63
      Tom Lane 提交于
      to a UNION, CASE, or related construct are of the same domain type.  The
      main part of this routine smashes domains to their base types, which seems
      necessary because the logic involves TypeCategory() and IsPreferredType(),
      neither of which work usefully on domains.  However, we can add a first
      pass that just detects whether all the inputs are exactly the same type,
      and if so accept that without question (so long as it's not UNKNOWN).
      Per recent gripe from Dean Rasheed.
      
      In passing, remove some tests for InvalidOid, which have clearly been dead
      code for quite some time now, because getBaseType() would fail on that input.
      
      Also, clarify the manual's not-very-precise description of the existing
      algorithm's behavior.
      07daff63
  13. 16 11月, 2007 1 次提交
  14. 07 9月, 2007 1 次提交
    • T
      Make eval_const_expressions() preserve typmod when simplifying something like · f8942f4a
      Tom Lane 提交于
      null::char(3) to a simple Const node.  (It already worked for non-null values,
      but not when we skipped evaluation of a strict coercion function.)  This
      prevents loss of typmod knowledge in situations such as exhibited in bug
      #3598.  Unfortunately there seems no good way to fix that bug in 8.1 and 8.2,
      because they simply don't carry a typmod for a plain Const node.
      
      In passing I made all the other callers of makeNullConst supply "real" typmod
      values too, though I think it probably doesn't matter anywhere else.
      f8942f4a
  15. 21 8月, 2007 1 次提交
  16. 07 6月, 2007 1 次提交
    • T
      Fix up text concatenation so that it accepts all the reasonable cases that · 2d4db367
      Tom Lane 提交于
      were accepted by prior Postgres releases.  This takes care of the loose end
      left by the preceding patch to downgrade implicit casts-to-text.  To avoid
      breaking desirable behavior for array concatenation, introduce a new
      polymorphic pseudo-type "anynonarray" --- the added concatenation operators
      are actually text || anynonarray and anynonarray || text.
      2d4db367
  17. 06 6月, 2007 1 次提交
    • T
      Downgrade implicit casts to text to be assignment-only, except for the ones · 31edbadf
      Tom Lane 提交于
      from the other string-category types; this eliminates a lot of surprising
      interpretations that the parser could formerly make when there was no directly
      applicable operator.
      
      Create a general mechanism that supports casts to and from the standard string
      types (text,varchar,bpchar) for *every* datatype, by invoking the datatype's
      I/O functions.  These new casts are assignment-only in the to-string direction,
      explicit-only in the other, and therefore should create no surprising behavior.
      Remove a bunch of thereby-obsoleted datatype-specific casting functions.
      
      The "general mechanism" is a new expression node type CoerceViaIO that can
      actually convert between *any* two datatypes if their external text
      representations are compatible.  This is more general than needed for the
      immediate feature, but might be useful in plpgsql or other places in future.
      
      This commit does nothing about the issue that applying the concatenation
      operator || to non-text types will now fail, often with strange error messages
      due to misinterpreting the operator as array concatenation.  Since it often
      (not always) worked before, we should either make it succeed or at least give
      a more user-friendly error; but details are still under debate.
      
      Peter Eisentraut and Tom Lane
      31edbadf
  18. 02 4月, 2007 1 次提交
  19. 28 3月, 2007 1 次提交
    • T
      Fix array coercion expressions to ensure that the correct volatility is · bf940763
      Tom Lane 提交于
      seen by code inspecting the expression.  The best way to do this seems
      to be to drop the original representation as a function invocation, and
      instead make a special expression node type that represents applying
      the element-type coercion function to each array element.  In this way
      the element function is exposed and will be checked for volatility.
      Per report from Guillaume Smet.
      bf940763
  20. 17 3月, 2007 1 次提交
    • T
      Fix up the remaining places where the expression node structure would lose · 0f4ff460
      Tom Lane 提交于
      available information about the typmod of an expression; namely, Const,
      ArrayRef, ArrayExpr, and EXPR and ARRAY SubLinks.  In the ArrayExpr and
      SubLink cases it wasn't really the data structure's fault, but exprTypmod()
      being lazy.  This seems like a good idea in view of the expected increase in
      typmod usage from Teodor's work to allow user-defined types to have typmods.
      In particular this responds to the concerns we had about eliminating the
      special-purpose hack that exprTypmod() used to have for BPCHAR Consts.
      We can now tell whether or not such a Const has been cast to a specific
      length, and report or display properly if so.
      
      initdb forced due to changes in stored rules.
      0f4ff460
  21. 06 1月, 2007 1 次提交
  22. 24 12月, 2006 1 次提交
  23. 22 12月, 2006 1 次提交
  24. 11 12月, 2006 1 次提交
    • T
      Add a paramtypmod field to Param nodes. This is dead weight for Params · 9fa12ddd
      Tom Lane 提交于
      representing externally-supplied values, since the APIs that carry such
      values only specify type not typmod.  However, for PARAM_SUBLINK Params
      it is handy to carry the typmod of the sublink's output column.  This
      is a much cleaner solution for the recently reported 'could not find
      pathkey item to sort' and 'failed to find unique expression in subplan
      tlist' bugs than my original 8.2-compatible patch.  Besides, someday we
      might want to support typmods for external parameters ...
      9fa12ddd
  25. 28 11月, 2006 1 次提交
  26. 12 10月, 2006 1 次提交
    • T
      Repair incorrect check for coercion of unknown literal to ANYARRAY, a bug · 772c5ba3
      Tom Lane 提交于
      I introduced in 7.4.1 :-(.  It's correct to allow unknown to be coerced to
      ANY or ANYELEMENT, since it's a real-enough data type, but it most certainly
      isn't an array datatype.  This can cause a backend crash but AFAICT is not
      exploitable as a security hole.  Per report from Michael Fuhr.
      
      Note: as fixed in HEAD, this changes a constant in the pg_stats view,
      resulting in a change in the expected regression outputs.  The back-branch
      patches have been hacked to avoid that, so that pre-existing installations
      won't start failing their regression tests.
      772c5ba3
  27. 04 10月, 2006 1 次提交
  28. 27 7月, 2006 1 次提交
  29. 26 7月, 2006 1 次提交
  30. 14 7月, 2006 2 次提交
  31. 17 6月, 2006 1 次提交
    • T
      Fix problems with cached tuple descriptors disappearing while still in use · 06e10abc
      Tom Lane 提交于
      by creating a reference-count mechanism, similar to what we did a long time
      ago for catcache entries.  The back branches have an ugly solution involving
      lots of extra copies, but this way is more efficient.  Reference counting is
      only applied to tupdescs that are actually in caches --- there seems no need
      to use it for tupdescs that are generated in the executor, since they'll go
      away during plan shutdown by virtue of being in the per-query memory context.
      Neil Conway and Tom Lane
      06e10abc
  32. 22 4月, 2006 1 次提交
  33. 06 4月, 2006 1 次提交
    • T
      Fix a bunch of problems with domains by making them use special input functions · 7fdb4305
      Tom Lane 提交于
      that apply the necessary domain constraint checks immediately.  This fixes
      cases where domain constraints went unchecked for statement parameters,
      PL function local variables and results, etc.  We can also eliminate existing
      special cases for domains in places that had gotten it right, eg COPY.
      
      Also, allow domains over domains (base of a domain is another domain type).
      This almost worked before, but was disallowed because the original patch
      hadn't gotten it quite right.
      7fdb4305
  34. 05 4月, 2006 1 次提交
    • T
      Modify all callers of datatype input and receive functions so that if these · 147d4bf3
      Tom Lane 提交于
      functions are not strict, they will be called (passing a NULL first parameter)
      during any attempt to input a NULL value of their datatype.  Currently, all
      our input functions are strict and so this commit does not change any
      behavior.  However, this will make it possible to build domain input functions
      that centralize checking of domain constraints, thereby closing numerous holes
      in our domain support, as per previous discussion.
      
      While at it, I took the opportunity to introduce convenience functions
      InputFunctionCall, OutputFunctionCall, etc to use in code that calls I/O
      functions.  This eliminates a lot of grotty-looking casts, but the main
      motivation is to make it easier to grep for these places if we ever need
      to touch them again.
      147d4bf3
  35. 05 3月, 2006 1 次提交
  36. 13 1月, 2006 1 次提交
  37. 23 11月, 2005 1 次提交
  38. 15 10月, 2005 1 次提交
  39. 05 6月, 2005 1 次提交