Re: text search vs schemas

From: "Trevor Talbot" <quension(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Gregory Stark" <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su>, "Teodor Sigaev" <teodor(at)sigaev(dot)ru>
Subject: Re: text search vs schemas
Date: 2007-08-18 09:35:21
Message-ID: 90bce5730708180235m4b30cf54pf1648f74d5d230cf@mail.gmail.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> wrote:
> Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> > "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> >> Uh, no. Function names for example are subject to search-path
> >> confusion.
>
> > Wait, are they? They are in PL languages but only because most
> > languages store their source code as text just as is happening here.
>
> Hmmm ... if you look at the current solution for default expressions
> for serial columns, ie nextval() on a regclass constant, it's pretty
> schema-safe. So we could imagine inventing a regconfig datatype that
> is the same sort of wrapper-over-OID. Then make the 2-parameter form
> of to_tsvector take that type instead of text.

Right, that's what I was getting at. I was confused about the trigger
issues, sorry about that.

> That seems like it'd fix the problem for expression indexes on
> to_tsvector calls, but I don't see how it fixes the problem for
> triggers. We don't have any clear path for making trigger arguments
> be anything but a list of strings.

Okay, trying to catch up here...

For the simple case of handling a single column, we've got expression
indexes as above.

For handling two or more columns, expression indexes don't work that
well, so that leaves triggers. There happens to be one utility
function provided for that purpose, tsvector_update_trigger(). This
trigger function needs its configuration as a (string) argument, and
is also the only one with this problem.

Is that correct?

If so, then it seems the question should really be: is this situation
of wanting to index multiple columns together, without even using
different ranks for them, so common that this trigger function belongs
in core? Maybe it shouldn't be there at all; instead have the docs
walk through creating a specialized trigger function. It doesn't get
rid of the schema-qualified names issue, but when you're writing PL
functions you need to deal with that anyway, tsearch or not.

And there's still contrib of course.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Trevor Talbot 2007-08-18 09:38:42 Re: text search vs schemas
Previous Message Oleg Bartunov 2007-08-18 05:54:59 Re: tsearch2 in PostgreSQL 8.3?