Re: ts_rewrite aggregate API seems mighty ugly

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su>, "Teodor Sigaev" <teodor(at)sigaev(dot)ru>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ts_rewrite aggregate API seems mighty ugly
Date: 2007-10-18 16:07:20
Message-ID: 87myugwgnb.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
>> The two-argument form may not be actively broken but it sounds not very
>> integrated. Passing a string which is then planned as an SQL query is not very
>> SQL-ish.
>
> True. I'll bet you don't like ts_stat() either.

It seems the right way interface here wouldn't be too different from what's
there. All we need is a SRF which takes a single tsvector and returns the set
of words from it.

Then you could do the aggregates yourself in SQL:

SELECT count(distinct apodid) as ndoc,
count(*) as nentry,
element
FROM (
SELECT apodid, ts_elements(vector) AS element
FROM apod
) GROUP BY element

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2007-10-18 16:22:47 Re: Can a C function(server program) be a UDP or TCP server?
Previous Message Florian G. Pflug 2007-10-18 16:03:56 Re: Why copy_relation_data only use wal whenWALarchivingis enabled