From: | "Sergey E(dot) Koposov" <math(at)sai(dot)msu(dot)ru> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | two-argument aggregates and SQL 2003 |
Date: | 2006-04-13 13:21:12 |
Message-ID: | Pine.LNX.4.44.0604131644260.20730-100000@lnfm1.sai.msu.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 for me that the structure of the pg_aggregate and
pg_proc tables do not prevent the creating of the two-argument
aggregate functions -- Just for each two-arg. aggregate, the corresponding
three-arg. transition function and the two-arg. aggregate_dummy function
should be added to the pg_proc and a record should be added to the
pg_aggregate. 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 ?
2) Also I thought about allowing the user to create the new two-arg.
aggregates. With that I only saw one thing which could/should be changed,
and this is the handling of the BASETYPE attribute of the CREATE AGGREGATE
command.
CREATE AGGREGATE name (
BASETYPE = input_data_type,
SFUNC = sfunc,
STYPE = state_data_type ... )
I am not very familiar with the parser/lexer details in postgres, but is it
possible to allow to do things like that :
CREATE AGGREGATE new_2arg_agg ( BASETYPE = (int,int) , .... )
to create the two-arg. aggregates ?
I'd like to hear any comments/advices/objections...
Regards,
Sergey
*****************************************************
Sergey E. Koposov
Max Planck Institute for Astronomy/Sternberg Astronomical Institute
Web: http://lnfm1.sai.msu.ru/~math
E-mail: math(at)sai(dot)msu(dot)ru
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2006-04-13 13:34:10 | Re: Practical impediment to supporting multiple SSL libraries |
Previous Message | Martijn van Oosterhout | 2006-04-13 13:07:56 | Re: Practical impediment to supporting multiple SSL libraries |