Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-15 Thread Tom Lane
"Jim C. Nasby" <[EMAIL PROTECTED]> writes: > On Sat, Apr 15, 2006 at 12:51:24AM -0400, Tom Lane wrote: >> I had an epiphany that might serve as illustration of the above. We >> have traditionally thought of COUNT(*) as an "aggregate over any base >> type". But wouldn't it be cleaner to think of i

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-15 Thread Jim C. Nasby
On Sat, Apr 15, 2006 at 12:51:24AM -0400, Tom Lane wrote: > I wrote: > > ... Polya's Inventors' Paradox states that > > "the more general problem may be easier to solve", and I've found that > > usually holds up in program design too. > > While fooling around with the grammar patch that I showed e

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-14 Thread Tom Lane
I wrote: > ... Polya's Inventors' Paradox states that > "the more general problem may be easier to solve", and I've found that > usually holds up in program design too. While fooling around with the grammar patch that I showed earlier today, I had an epiphany that might serve as illustration of th

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-14 Thread Tom Lane
I wrote [ in an off-list reply to Mark Dilger ]: > I don't think this solves the parsing problem at all. The problem as I > see it is that given > CREATE AGGREGATE foo (bar ... > it's not obvious whether bar is a def_elem name (old syntax) or a type > name (new syntax). It's possible that w

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-14 Thread Mark Dilger
Tom Lane wrote: > I would really prefer to see CREATE AGGREGATE normalized to have a > syntax comparable to CREATE FUNCTION (or DROP AGGREGATE for that > matter): > CREATE AGGREGATE aggname (typname [, ... ]) ...definition... > but it's not clear how to get there without breaking backwards >

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-14 Thread Tom Lane
"Sergey E. Koposov" <[EMAIL PROTECTED]> writes: > Does it make sense to extend the aggregate > functions to the only two-argument case? No, I don't think so, for two reasons: 1. The user's-eye view: if someone wants 2 arguments, tomorrow he'll want 3, etc. There's an old saying that "the only go

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-14 Thread Sergey E. Koposov
On Thu, 13 Apr 2006, Tom Lane wrote: > "Sergey E. Koposov" <[EMAIL PROTECTED]> writes: > > ... Nothing else and nothing internal need not to be changed to > > insert new two-arg. aggregate functions into the core. > > Am I right in this ? > > IIRC the main issues are the syntax of CREATE AGGRE

Re: [HACKERS] two-argument aggregates and SQL 2003

2006-04-13 Thread Tom Lane
"Sergey E. Koposov" <[EMAIL PROTECTED]> writes: > ... Nothing else and nothing internal need not to be changed to > insert new two-arg. aggregate functions into the core. > Am I right in this ? IIRC the main issues are the syntax of CREATE AGGREGATE and the actual implementation in nodeAgg.c.

[HACKERS] two-argument aggregates and SQL 2003

2006-04-13 Thread Sergey E. Koposov
Hello All, I just thought about implementing some two-argument aggregate functions from SQL 2003 (like CORR(x,y), REGR_SLOPE(x,y) etc...) ( http://www.wiscorp.com/SQL2003Features.pdf , page 10) 1) I looked into the architecture of how the aggregate functions are created and used, and it seemed f