Proposed new create command, CREATE OPERATOR CLASS

Поиск
Список
Период
Сортировка
От Bill Studenmund
Тема Proposed new create command, CREATE OPERATOR CLASS
Дата
Msg-id Pine.NEB.4.33.0110230400080.8537-100000@vespasia.home-net.internetconnect.net
обсуждение исходный текст
Ответы Re: Proposed new create command, CREATE OPERATOR CLASS  (Bill Studenmund <wrstuden@netbsd.org>)
Re: Proposed new create command, CREATE OPERATOR CLASS  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Proposed new create command, CREATE OPERATOR CLASS  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
I'd like to propose a new command, CREATE OPERATOR CLASS. Its purpose is
to create a named operator class, so that you can create new types of
index ops. Also, its inclusion would remove the section of the
documentation where we tell people how to manually manipulate the system
tables.

Since schema support is going to change some of the details of the system
tables in important ways, I think it's better to move away from manual
updates.

The command is basically an instrumentation of the documentation on how to
add new operator classes.

Here's the syntax I'd like to propose:

CREATE OPERATOR CLASS <name> [DEFAULT] FOR TYPE <typename> USING <access
method> WITH <list of operators> AND <list of support functions>

New keywords are "CLASS" (SQL99 reserved word) and "REPEATABLE" (SQL99
non-reserved word, see below for usage).

<name> is the class's name, and <typename> is the type to be indexed.
<access method> is the assosciated access method from pg_am (btree, rtree,
hash, gist).

The presence of [DEFAULT] indicates that this operator class shold be made
the default operator class for the type.

<list of operators> is a comma-delimited list of operator specs. An
operator spec is either an operator or an operator followed by the keyword
"REPEATABLE". The presence of "REPEATABLE" indicates that amopreqcheck
should be set to true for this operator. Each item in this list will
generate an entry in pg_amop.

<list of support functions> is a comma-seperated list of functions used to
assist the index method. Each item in this list will generate an item in
pg_amproc.

I agree that I think it is rare that anything will set "REPEATABLE", but
the point of this effort is to keep folks from mucking around with the
system tables manually, so we should support making any reasonable entry
in pg_amop.

Here's an example based on the programmer's guide. We've created the type
"complex", and have comparison functions complex_abs_lt, complex_abs_le,
complex_abs_eq, complex_abs_gt, complex_abs_ge. Then let us have created
operators "||<", "||<=", "||=", "||>", "||>=" based on them. We also have
the complex_abs_cmp helper function. To create the operator class, the
command would be:

CREATE OPERATOR CLASS complex_abs_ops DEFAULT FOR TYPE complex USING
btree with ||<, ||<=, ||=, ||>=, ||> and complex_abs_cmp;

Among other things, complex_abs_ops would be the default operator class
for the complex type after this command.


An example using REPEATABLE would be:

CREATE OPERATOR CLASS complex_abs_ops DEFAULT FOR TYPE complex USING btree
with ||< REPEATABLE, ||<=, ||=, ||>=, ||> REPEATABLE and complex_abs_cmp;

Note: I don't think the above command will create a correct operator
class, it just shows how to add REPEATABLE.

The alternative to "REPEATABLE" would be something like
"hit_needs_recheck" after the operator. Suggestions?

Thoughts?

Take care,

Bill



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: join instruction
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Compiling on Solaris with Sun compiler