1. 19 7月, 2011 1 次提交
  2. 19 4月, 2011 1 次提交
    • T
      Fix handling of collations in multi-row VALUES constructs. · 918854cc
      Tom Lane 提交于
      Per spec we ought to apply select_common_collation() across the expressions
      in each column of the VALUES table.  The original coding was just taking
      the first row and assuming it was representative.
      
      This patch adds a field to struct RangeTblEntry to carry the resolved
      collations, so initdb is forced for changes in stored rule representation.
      918854cc
  3. 12 4月, 2011 1 次提交
    • T
      Fix RI_Initial_Check to use a COLLATE clause when needed in its query. · 921b9936
      Tom Lane 提交于
      If the referencing and referenced columns have different collations,
      the parser will be unable to resolve which collation to use unless it's
      helped out in this way.  The effects are sometimes masked, if we end up
      using a non-collation-sensitive plan; but if we do use a mergejoin
      we'll see a failure, as recently noted by Robert Haas.
      
      The SQL spec states that the referenced column's collation should be used
      to resolve RI checks, so that's what we do.  Note however that we currently
      don't append a COLLATE clause when writing a query that examines only the
      referencing column.  If we ever support collations that have varying
      notions of equality, that will have to be changed.  For the moment, though,
      it's preferable to leave it off so that we can use a normal index on the
      referencing column.
      921b9936
  4. 10 4月, 2011 1 次提交
    • T
      Adjust collation determination rules as per discussion. · a19002d4
      Tom Lane 提交于
      Remove crude hack that tried to propagate collation through a
      function-returning-record, ie, from the function's arguments to individual
      fields selected from its result record.  That is just plain inconsistent,
      because the function result is composite and cannot have a collation;
      and there's no hope of making this kind of action-at-a-distance work
      consistently.  Adjust regression test cases that expected this to happen.
      
      Meanwhile, the behavior of casting to a domain with a declared collation
      stays the same as it was, since that seemed to be the consensus.
      a19002d4
  5. 25 3月, 2011 1 次提交
  6. 23 3月, 2011 1 次提交
    • T
      Throw error for indeterminate collation of an ORDER/GROUP/DISTINCT target. · 37d6d07d
      Tom Lane 提交于
      This restores a parse error that was thrown (though only in the ORDER BY
      case) by the original collation patch.  I had removed it in my recent
      revisions because it was thrown at a place where collations now haven't
      been computed yet; but I thought of another way to handle it.
      
      Throwing the error at parse time, rather than leaving it to be done at
      runtime, is good because a syntax error pointer is helpful for localizing
      the problem.  We can reasonably assume that the comparison function for a
      collatable datatype will complain if it doesn't have a collation to use.
      Now the planner might choose to implement GROUP or DISTINCT via hashing,
      in which case no runtime error would actually occur, but it seems better
      to throw error consistently rather than let the error depend on what the
      planner chooses to do.  Another possible objection is that the user might
      specify a nondefault sort operator that doesn't care about collation
      ... but that's surely an uncommon usage, and it wouldn't hurt him to throw
      in a COLLATE clause anyway.  This change also makes the ORDER BY/GROUP
      BY/DISTINCT case more consistent with the UNION/INTERSECT/EXCEPT case,
      which was already coded to throw this error even though the same objections
      could be raised there.
      37d6d07d
  7. 21 3月, 2011 1 次提交