two-argument aggregates and SQL 2003

Поиск
Список
Период
Сортировка
От Sergey E. Koposov
Тема two-argument aggregates and SQL 2003
Дата
Msg-id Pine.LNX.4.44.0604131644260.20730-100000@lnfm1.sai.msu.ru
обсуждение исходный текст
Ответы Re: two-argument aggregates and SQL 2003  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@sai.msu.ru



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Practical impediment to supporting multiple SSL libraries
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Practical impediment to supporting multiple SSL libraries