Re: [HACKERS] a problem with index and user define type

2003-06-26 Thread Weiping He
Tom Lane wrote: Weiping He [EMAIL PROTECTED] writes: because the data type (UUID) is a struct, and the uuid_eq() function accept two pointer to the value of struct uuid, if make it IMMUTABLE, postgresql would think it should not try to run the function, but return the cached value instead when

Re: [HACKERS] a problem with index and user define type

2003-06-25 Thread Tom Lane
Weiping He [EMAIL PROTECTED] writes: because the data type (UUID) is a struct, and the uuid_eq() function accept two pointer to the value of struct uuid, if make it IMMUTABLE, postgresql would think it should not try to run the function, but return the cached value instead when it get two same

Re: [HACKERS] a problem with index and user define type

2003-06-24 Thread Tom Lane
Weiping He [EMAIL PROTECTED] writes: we found the problem: We used IMMUTABLE modifier in our CREATE FUNCTION definition, though it's correct for our function to return same value if input the same *data*, but our data are passed by reference, not by value, so, some times we can't retrive

Re: [HACKERS] a problem with index and user define type

2003-06-24 Thread Weiping He
Tom Lane wrote: Weiping He [EMAIL PROTECTED] writes: we found the problem: We used IMMUTABLE modifier in our CREATE FUNCTION definition, though it's correct for our function to return same value if input the same *data*, but our data are passed by reference, not by value, so, some times we

Re: [HACKERS] a problem with index and user define type

2003-06-23 Thread Weiping He
we found the problem: We used IMMUTABLE modifier in our CREATE FUNCTION definition, though it's correct for our function to return same value if input the same *data*, but our data are passed by reference, not by value, so, some times we can't retrive out data. Remove IMMUTABLE fixed the problem.

Re: [HACKERS] a problem with index and user define type

2003-06-22 Thread Weiping He
Tom Lane wrote: Wang Mike [EMAIL PROTECTED] writes: but this query: select * from test_uuid where id = 'df2b10aa-a31d-11d7-9867-0050babb6029'::uuid dosn't use index QUERY PLAN --- Seq Scan on

Re: [HACKERS] a problem with index and user define type

2003-06-22 Thread Tom Lane
Weiping He [EMAIL PROTECTED] writes: the situation trun worse: now the explain shows the query using the index, the we can't select out the match row! Any hint about what's wrong with us? My bet: either your operators are broken or your operator class definition is wrong.

[HACKERS] a problem with index and user define type

2003-06-21 Thread Wang Mike
Hi all: I write a use define type (UUID) typedef struct uuid { uint32 time_low; uint16 time_mid; uint16 time_hi_and_version; uint8 clock_seq_hi_and_reserved; uint8 clock_seq_low; uint8 node[6]; } uuid; make all btree index function and operator,

Re: [HACKERS] a problem with index and user define type

2003-06-21 Thread Tom Lane
Wang Mike [EMAIL PROTECTED] writes: but this query: select * from test_uuid where id = 'df2b10aa-a31d-11d7-9867-0050babb6029'::uuid dosn't use index QUERY PLAN --- Seq Scan on test_uuid