Re: knngist - 0.8

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: knngist - 0.8
Дата
Msg-id 21593.1290472436@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: knngist - 0.8  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: knngist - 0.8  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I've done some *very* preliminary review of this patch now.  I think
that the way to move forward is to first commit the work surrounding
changes to pg_amop, including suitable changes to CREATE/ALTER OPERATOR
CLASS/FAMILY so that there's a way to put the new info into the table.
The system won't initially *do* anything useful with ordering-operator
entries, but this is necessary infrastructure before we can start to
do anything interesting.

After reviewing both Teodor's and Robert's patches for the issue,
I believe that Teodor has a better basic approach: if an operator
is useful for both searching and ordering, the way to handle that
is to make two pg_amop entries for it, with different strategy
numbers.  This means in particular that we can continue to require
strategy numbers to be unique within an opclass, so right offhand
I see no need to widen pg_amop_fam_strat_index to five columns.
(Which means we don't need that patch to allow five-key syscaches.)
What we need instead is to add the "purpose" column to the existing
unique index on (amopopr, amopfamily).  In English that means that
instead of allowing an operator to have only one entry per opfamily,
it can now have one entry per opfamily per purpose.

I do however concur with Robert that it's a bit silly to go to all this
work and not leave room in the design for additional operator "purposes"
later.  So rather than using a boolean amoporder column, I think we want
an enumerated-type column "amoppurpose".  Per our usual system catalog
conventions for "poor man's enums", I suggest declaring the column as
"char" with the two allowed valuesAMOP_SEARCH    's'AMOP_ORDER    'o'
Aside from leaving room for possible extension, I think that using
AMOP_SEARCH/AMOP_ORDER rather than true/false in the code will be more
readable and less error-prone.

As far as the syntax of CREATE/ALTER OPERATOR CLASS/FAMILY is concerned,
I like Robert's proposal (OPERATOR ... FOR ORDER or FOR SEARCH) better
than Teodor's, though we don't need the multiple-purposes-per-entry
aspect of it.  This is mainly because it looks more easily extensible
if we ever do get around to having more purposes.

There's a lot more to be done after this, but if there are no objections
to this much, I'll go merge the relevant parts of the two patches and
commit.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: s/LABEL/VALUE/ for ENUMs
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: s/LABEL/VALUE/ for ENUMs