I've asked related question on General list, but got no answer,
although I have been able to work around that issue a little bit.
There is one snag I encountered and I have no idea on how to work it
I need to modify TSQuery object (add another operator and do some
stuff with it) - this is done and works properly at C code level. Now
I need to implement changes done in C on PG level. I really do not
want to make another type, tsquery2 or such...
What I've tried:
- the manual states that you can create your own data types with
CREATE TYPE command and alter some of their proprieties with ALTER
TYPE. But it is not possible to modify INPUT or OUTPUT function.
- I have created updated PG versions of the functions to_tsquery (the
CAST function) and tsqueryout (the TYPE OUTPUT) function and they are
in the "public" schema.
- I have created a CAST from text to tsquery pointing to
- I have changed the search_path so the "public" schema is first.
How do I overwrite the default behaviour of Postgres 8.4, so I can
successfully run the following queries:
SELECT 'cat & dog & mouse'::tsquery; --uses the built in function
SELECT to_tsquery('cat & dog & mouse'); --also uses the built in function
SELECT public.to_tsquery('cat & dog & mouse'); --uses new functions
SELECT CAST('dogs & cat' AS tsquery); --uses the built in function
SELECT CAST('dogs & cat'::text AS tsquery); --uses new functions
SELECT public.to_tsquery('dog " mouse'); --new operator (doublequote),
works fine until OUTPUT function is called and as it is the default
one an error is displayed
SELECT public.tsqueryout(CAST('dogs " cat'::text AS tsquery)); --uses
new functions and displays correctly
I thought that setting schema so "public" has priority over all other
would make PG use those functions in the first place. Also is the
string between the single quotes in SQL commands not treated as text
type? Is this why a CAST to ::text make it work in example 2?
Thanks in advance.
pgsql-hackers by date
|Next:||From: Dhiraj Lohiya||Date: 2010-04-09 10:24:24|
|Subject: Re: Enhancing phonetic search support for more languages - GSoC 2010|
|Previous:||From: Fujii Masao||Date: 2010-04-09 08:18:35|
|Subject: Re: Remaining Streaming Replication Open Items|