Bug in LIKE operator processing

Started by Żak, Sławomirabout 23 years ago3 messagesbugs
Jump to latest

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 | not null 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

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Żak, Sławomir (#1)
Re: Bug in LIKE operator processing

On Mon, 27 Jan 2003, [iso-8859-2] �ak, S�awomir 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).

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Żak, Sławomir (#1)
Re: Bug in LIKE operator processing

=?iso-8859-2?Q?=AFak=2C_S=B3awomir?= <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