vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| The following bug has been logged online: Bug reference: 3438 Logged by: radoslav hodnicak Email address: rh@4096.sk PostgreSQL version: 8.2.4 Operating system: Windows XP SP2 Description: Problem selecting backslash from a byte array Details: I create a table with a byte array column and insert a row with the byte 92 into it (which is backslash). Then I want to select the row. Steps to reproduce: create table backslashtest (test bytea null); insert into backslashtest values (E'\\134'::bytea); select * from backslashtest where test like E'\\134'::bytea; Result: select returns no rows Expected result: select should return the row I've inserted Other remarks: select * from backslashtest where test like E'\\134\\134'::bytea; does what I expected from the original select, but that's wrong because I don't want two backslashes, only one ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| |||
| it's not bug. You didn't use any wild char. And like predicate isn't defined for bytea. There is another strange behave postgres=# select position(E'\\134\\134'::bytea in test) from backslashtest ; position ---------- 0 (1 row) Regards Pavel Stehule > > I create a table with a byte array column and insert a row with the byte 92 > into it (which is backslash). Then I want to select the row. > > Steps to reproduce: > > create table backslashtest (test bytea null); > > insert into backslashtest values (E'\\134'::bytea); > > select * from backslashtest where test like E'\\134'::bytea; > > Result: > select returns no rows > > Expected result: > select should return the row I've inserted > > Other remarks: > select * from backslashtest where test like E'\\134\\134'::bytea; > > does what I expected from the original select, but that's wrong because I > don't want two backslashes, only one > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match |
| ||||
| "radoslav hodnicak" <rh@4096.sk> writes: > create table backslashtest (test bytea null); > insert into backslashtest values (E'\\134'::bytea); > select * from backslashtest where test like E'\\134'::bytea; Backslash is a special character to LIKE. Perhaps you would prefer to specify another escape character, or none at all: select * from backslashtest where test like E'\\134'::bytea escape ''; If you don't want any special pattern characters, why are you using LIKE rather than plain = ? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |