Обсуждение: Bug in LIKE operator processing
I've found that statement: SELECT * FROM os WHERE 'FreeBSD 4.7-RC' LIKE string_id; (one of string_id's is 'FreeBSD 4.7%') doesn't work. No error is reported. It does work in Oracle, so I think it's a standard SQL query. Table is defined as: host=> \d os Table "os" Column | Type | Modifiers -----------+-----------------------+-----------------------------------------------id | integer | notnull default nextval('"os_id_seq"'::text)name | character varying(32) | major | integer | minor | integer | subrev | character(16) | string_id | character(32) | Unique keys: os_id_key PostgreSQL version is 7.3.1 Is it non-implemented by design, or maybe I've overlooked something? Thanks, /S
On Mon, 27 Jan 2003, [iso-8859-2] =AFak, S=B3awomir wrote: > I've found that statement: > > SELECT * FROM os WHERE 'FreeBSD 4.7-RC' > LIKE string_id; (one of string_id's is 'FreeBSD 4.7%') > string_id | character(32) | character(32) has space padding which is probably getting in your way. I'd suggest moving to varchar(32).
Żak, Sławomir <SZak@era.pl> writes: > I've found that statement: > SELECT * FROM os WHERE 'FreeBSD 4.7-RC' > LIKE string_id; (one of string_id's is 'FreeBSD 4.7%') > doesn't work. No error is reported. It does work in Oracle, It'd probably work in Postgres too, if you'd used varchar(n) rather than char(n) for string_id. As is, the trailing spaces in string_id are considered significant. regards, tom lane