Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

parse_clause.c

  • Tom Lane's avatar
    fba999cb
    Allow ORDER BY/GROUP BY/etc items to match targetlist items regardless of · fba999cb
    Tom Lane authored
    any implicit casting previously applied to the targetlist item.  This is
    reasonable because the implicit cast, by definition, wasn't written by the
    user; so we are preserving the expected behavior that ORDER BY items match
    textually equivalent tlist items.  The case never arose before because there
    couldn't be any implicit casting of a top-level SELECT item before we process
    ORDER BY etc.  But now it can arise in the context of aggregates containing
    ORDER BY clauses, since the "targetlist" is the already-casted list of
    arguments for the aggregate.  The net effect is that the datatype used for
    ORDER BY/DISTINCT purposes is the aggregate's declared input type, not that
    of the original input column; which is a bit debatable but not horrendous,
    and to do otherwise would require major rework that doesn't seem justified.
    
    Per bug #5564 from Daniel Grace.  Back-patch to 9.0 where aggregate ORDER BY
    was implemented.
    fba999cb
    History
    Allow ORDER BY/GROUP BY/etc items to match targetlist items regardless of
    Tom Lane authored
    any implicit casting previously applied to the targetlist item.  This is
    reasonable because the implicit cast, by definition, wasn't written by the
    user; so we are preserving the expected behavior that ORDER BY items match
    textually equivalent tlist items.  The case never arose before because there
    couldn't be any implicit casting of a top-level SELECT item before we process
    ORDER BY etc.  But now it can arise in the context of aggregates containing
    ORDER BY clauses, since the "targetlist" is the already-casted list of
    arguments for the aggregate.  The net effect is that the datatype used for
    ORDER BY/DISTINCT purposes is the aggregate's declared input type, not that
    of the original input column; which is a bit debatable but not horrendous,
    and to do otherwise would require major rework that doesn't seem justified.
    
    Per bug #5564 from Daniel Grace.  Back-patch to 9.0 where aggregate ORDER BY
    was implemented.