Re: Aggregate functions with two or more arguments?
От | Tom Lane |
---|---|
Тема | Re: Aggregate functions with two or more arguments? |
Дата | |
Msg-id | 20454.1089900171@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Aggregate functions with two or more arguments? (Mike Mascari <mascarm@mascari.com>) |
Список | pgsql-general |
> Brian K Boonstra wrote: >> ... aggregate functions >> appear to want just a single argument, so I feel like either I am on the >> wrong track, or I have run into a limitation of postgresql. Sooner or later someone should fix aggregates to allow multiple inputs. There was once a restriction in the catalog layout that prevented it, but that's been gone since 7.3 or so. I think the only part that would be even slightly difficult is supporting DISTINCT aggregates. Mike Mascari <mascarm@mascari.com> writes: > I'm not sure what the most elegant solution is, but when I've > encountered this scenario in the past, I created a custom type for > the aggregate. This will actually be quite painless in 7.5, since you can just use a composite type. It'd go something like create type mytype as (f1 int, f2 text); ... create aggregate accepting mytype as input ... select myagg(row(x,y)) from table; No need for any C code. regards, tom lane
В списке pgsql-general по дате отправления: