Re: TODO items for window functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>
Cc: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, David Fetter <david(at)fetter(dot)org>, "Hitoshi Harada" <umi(dot)tanuki(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: TODO items for window functions
Date: 2008-12-31 02:38:24
Message-ID: 19562.1230691104@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Robert Haas" <robertmhaas(at)gmail(dot)com> writes:
>> Apparently that analogy didn't impress anyone but me.

> It impressed me. I liked making WINDOW a flag that occurs later in
> the statement a lot better.

I ended up going with the flag/attribute approach. The other would be
only marginally more work now, but I remain convinced that we'd have to
do more work later to deal with the issue that CREATE WINDOW FUNCTION
looks like "window function" is a distinct kind of SQL object. And
nobody seemed to want to propagate that distinction into all the places
it would logically have to go.

However ... having said that, there is more to David Fetter's gripe
about \df than I realized at first. Consider

regression=# \df nth_value
List of functions
Schema | Name | Result data type | Argument data types
------------+-----------+------------------+---------------------
pg_catalog | nth_value | anyelement | anyelement, integer
(1 row)

Even without any consideration of user-defined window functions,
this seems a bit lacking: the user of nth_value() needs to know that
he has to write an OVER clause, and as things stand \df is not going
to give him the slightest hint about that. So I can see the argument
for reflecting window-ness into \df somehow.

I am not thrilled about inventing a new column for this, but how about
a display like so:

regression=# \df nth_value
List of functions
Schema | Name | Result data type | Argument data types
------------+-----------+------------------+---------------------------------
pg_catalog | nth_value | anyelement | anyelement, integer OVER window

or some other addition that only shows up when needed.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-12-31 02:45:01 Re: version() output vs. 32/64 bits
Previous Message David Fetter 2008-12-31 01:15:06 Re: about truncate