P
P
pqgg7nwkd42018-12-12 16:40:39
PostgreSQL
pqgg7nwkd4, 2018-12-12 16:40:39

How much like with a percentage at the end is equivalent to between?

LC_COLLATE='ru_RU.UTF8' To what
extent are these two queries equivalent (assume that the code column does not contain characters with a code greater than \uFFFF)?

select * from t where code like '12345%';
select * from t where code BETWEEN '12345' AND '12345' || '\uFFFF'

All these dances due to indexing problems and like '12345%' and COLLATE = ru_RU

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-12-12
@pqgg7nwkd4

If the idea is implemented correctly, then they are equivalent. Must be. Yours is not equivalent yet, because

melkij=> select '\uFFFF';
 ?column? 
----------
 \uFFFF

This is how unicode escapes are not written. E'\uFFFF'
Although they usually take regular text_pattern_ops and like works fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question