Postgresql 8でこれが問題ない理由
select * from prod where code like '1%'
select * from prod where code like '%1'
しかし、これは0行を返します(数字1で始まる/終わるコードがあります)
select * from prod where code like '1%1'
アップデート
それは私の現在のインスタレーションで起こります:
# psql --version
psql (PostgreSQL) 8.3.7
create table a(code char(10));
CREATE TABLE
db=# insert into a values('111');
INSERT 0 1
db=# select * from a where code like '1%';
code
------------
111
(1 row)
db=# select * from a where code like '%1';
code
------
(0 rows)
db=# select * from a where code like '1%1';
code
------
(0 rows)
更新 2
それはデータ型です!varchar を使用すると、OK です。
ありがとうございました。