rollback; begin; create table test (bcol bytea); create index tst_idx on test(bcol); insert into test values ('abc'); insert into test values ('abcdef'); insert into test values ('abc\\003'); insert into test values ('abc\\002'); insert into test values ('abc\\004'); insert into test values ('abc\\005'); insert into test values ('\\001abc\\006'); insert into test values ('\\001xabc\\006'); insert into test values ('\\001\\002abc\\006'); insert into test values ('\\002\\003abc\\006'); insert into test values ('\\001abc\\006'); insert into test values ('\\001xabc\\006'); insert into test values ('\\001\\002abc\\006'); insert into test values ('\\000\\001\\002abc\\006'); insert into test values ('\\002\\003abc\\006'); set enable_indexscan=on; set enable_seqscan=off; select * from test where bcol like '\\001%'; select * from test where bcol like '\\001\002%'; select * from test where bcol like 'a%'; select * from test where bcol like '\\141%'; select * from test where bcol like 'ä%'; select * from test where bcol like '\\344%'; select * from test where bcol like '\1%'; explain analyze select * from test where bcol like '\\001%'; explain analyze select * from test where bcol like '\\001\002%'; explain analyze select * from test where bcol like 'a%'; explain analyze select * from test where bcol like '\\141%'; explain analyze select * from test where bcol like 'ä%'; explain analyze select * from test where bcol like '\\344%'; explain analyze select * from test where bcol like '\1%'; set enable_indexscan=off; set enable_seqscan=on; select * from test where bcol like '\\001%'; select * from test where bcol like '\\001\002%'; select * from test where bcol like 'a%'; select * from test where bcol like '\\141%'; select * from test where bcol like 'ä%'; select * from test where bcol like '\\344%'; select * from test where bcol like '\1%'; explain analyze select * from test where bcol like '\\001%'; explain analyze select * from test where bcol like '\\001\002%'; explain analyze select * from test where bcol like 'a%'; explain analyze select * from test where bcol like '\\141%'; explain analyze select * from test where bcol like 'ä%'; explain analyze select * from test where bcol like '\\344%'; explain analyze select * from test where bcol like '\1%';