Re: make_greater_string() does not return a string in some cases
От | Tatsuhito Kasahara |
---|---|
Тема | Re: make_greater_string() does not return a string in some cases |
Дата | |
Msg-id | 4C21D716.70808@oss.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: make_greater_string() does not return a string in some cases (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: make_greater_string() does not return a string in some cases
|
Список | pgsql-bugs |
Tom Lane wrote: > The patch you propose for this is really untenable: it will re-introduce > many corner cases that we got rid of years ago, for example cases > wherein pg_verifymbstr and pg_mbcliplen index off the end of the string > because they think the last character occupies more bytes than are > there. > Another problem is that if the last character is several bytes long, > this coding would cause us to iterate through potentially many millions > of character values before giving up and truncating off the last > character. Hmm... OK, I see your points. I have another idea. 1. We prepare new operators ( <,<=,>,=>,= ) for text and bytea. 2. In make_greater_string(), if multi-byte-string was set and using locale-C and could not find greater string, returns bytea which has greater byte-code of last-character. User will get the following result. ======================================================================================================= -- $B@>(B : 0xe8a5bf =# EXPLAIN ANALYZE SELECT * FROM test WHERE name LIKE '$B@>(B%'; QUERY PLAN ---------------------------------------------------------------------------------------------------------------- Index Scan using test_name on test (cost=0.00..8.28 rows=1 width=4) (actual time=0.022..0.024 rows=1 loops=1) Index Cond: ((name >= '$B@>(B'::text) AND (name < '\\xe8a5c0'::bytea)) Filter: (name ~~ '$B@>(B%'::text) Total runtime: 0.053 ms (4 rows) ======================================================================================================= Is the idea reasonable ? Best regards, -- NTT OSS Center Tatsuhito Kasahara
В списке pgsql-bugs по дате отправления: