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
    bb16dc49
    Modify the definition of window-function PARTITION BY and ORDER BY clauses · bb16dc49
    Tom Lane authored
    so that their elements are always taken as simple expressions over the
    query's input columns.  It originally seemed like a good idea to make them
    act exactly like GROUP BY and ORDER BY, right down to the SQL92-era behavior
    of accepting output column names or numbers.  However, that was not such a
    great idea, for two reasons:
    
    1. It permits circular references, as exhibited in bug #5018: the output
    column could be the one containing the window function itself.  (We actually
    had a regression test case illustrating this, but nobody thought twice about
    how confusing that would be.)
    
    2. It doesn't seem like a good idea for, eg, "lead(foo) OVER (ORDER BY foo)"
    to potentially use two completely different meanings for "foo".
    
    Accordingly, narrow down the behavior of window clauses to use only the
    SQL99-compliant interpretation that the expressions are simple expressions.
    bb16dc49
    History
    Modify the definition of window-function PARTITION BY and ORDER BY clauses
    Tom Lane authored
    so that their elements are always taken as simple expressions over the
    query's input columns.  It originally seemed like a good idea to make them
    act exactly like GROUP BY and ORDER BY, right down to the SQL92-era behavior
    of accepting output column names or numbers.  However, that was not such a
    great idea, for two reasons:
    
    1. It permits circular references, as exhibited in bug #5018: the output
    column could be the one containing the window function itself.  (We actually
    had a regression test case illustrating this, but nobody thought twice about
    how confusing that would be.)
    
    2. It doesn't seem like a good idea for, eg, "lead(foo) OVER (ORDER BY foo)"
    to potentially use two completely different meanings for "foo".
    
    Accordingly, narrow down the behavior of window clauses to use only the
    SQL99-compliant interpretation that the expressions are simple expressions.