Re: tsearch2 trigger alternative

From: Chris Gamache <cgg007(at)yahoo(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2 trigger alternative
Date: 2004-02-25 17:40:25
Message-ID: 20040225174025.56239.qmail@web13809.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


--- Teodor Sigaev <teodor(at)sigaev(dot)ru> wrote:
>
>
> Chris Gamache wrote:
> > Tsearch2 comes with its own tsearch2 trigger function. You pass column
> names to
> > it, and it puts a vanilla tsvector into the column named in TG_ARGV[0]. Not
> > only can you pass column names to it, but you can pass simple functions to
> it
> > as well. This is magical to me. :)
> look at tsvector.c:864
>
> numattr = SPI_fnumber(rel->rd_att, trigger->tgargs[i]);
> if (numattr == SPI_ERROR_NOATTRIBUTE)
> {
> funcoid = findFunc(trigger->tgargs[i]);
> if (funcoid == InvalidOid)
> ereport(ERROR,
> (errcode(ERRCODE_UNDEFINED_COLUMN),
> errmsg("could not find function or field \"%s\"",
> trigger->tgargs[i])));
> continue;
> }
>
> If current args (trigger->tgargs[i]) isn't a column name, then it's a
> function
> name. It's simple :)

Its like a circuit board to Genghis Kahn... :) I still wouldn't be able to
quickly write my own trigger. It occurrs to me that this might be an
opportunity to properly extend tsearch2, though.

I'm sure that the tsearch2 trigger could detect a tsvector type and allow it to
be inserted without modification. That would solve this problem completely! I
can't think of any practical argument against it. It makes sense that others
besides myself would want to selectively weight columns upon insert without
having to write their own custom trigger in C.

CG

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sally Sally 2004-02-25 18:43:11 REINDEX issues
Previous Message Uros Gruber 2004-02-25 17:33:25 Re: TG_RELNAME problem