Skip site navigation (1) Skip section navigation (2)

pgsql: Modify the definition of window-function PARTITION BY and ORDER

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Modify the definition of window-function PARTITION BY and ORDER
Date: 2009-08-27 20:08:12
Message-ID: 20090827200812.825FD75331E@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Modify the definition of window-function PARTITION BY and ORDER BY clauses
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.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/doc/src/sgml/ref:
        select.sgml (r1.122 -> r1.122.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/select.sgml?r1=1.122&r2=1.122.2.1)
    pgsql/doc/src/sgml:
        syntax.sgml (r1.133 -> r1.133.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/syntax.sgml?r1=1.133&r2=1.133.2.1)
    pgsql/src/backend/parser:
        analyze.c (r1.389 -> r1.389.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.389&r2=1.389.2.1)
        parse_clause.c (r1.189 -> r1.189.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_clause.c?r1=1.189&r2=1.189.2.1)
    pgsql/src/include/parser:
        parse_clause.h (r1.55 -> r1.55.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_clause.h?r1=1.55&r2=1.55.2.1)
    pgsql/src/test/regress/expected:
        window.out (r1.3 -> r1.3.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/window.out?r1=1.3&r2=1.3.2.1)
    pgsql/src/test/regress/sql:
        window.sql (r1.3 -> r1.3.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/window.sql?r1=1.3&r2=1.3.2.1)

pgsql-committers by date

Next:From: Tom LaneDate: 2009-08-28 17:42:54
Subject: pgsql: Non-Windows EXEC_BACKEND path was broken by recent
Previous:From: Tom LaneDate: 2009-08-27 20:08:03
Subject: pgsql: Modify the definition of window-function PARTITION BY and ORDER

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group