[pgsql-jp: 37272] 日付型の問い合わせ
Koichi Shimamura
maf01541 @ nifty.ne.jp
2006年 6月 21日 (水) 23:13:52 JST
島村です。
日付型のフィールドに問い合わせをするときは、シングルクォーテーションでく
くらないといけないのですが、これを付けずに問い合わせをかけるとエラーでは
なく、該当0件で結果が返ってきます。
これは正しい動作ですか?
my_db=> create table test (
my_db(> no int,
my_db(> name text,
my_db(> birthday date,
my_db(>
my_db(> primary key (no)
my_db(> );
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
"test_pkey" for table "test"
CREATE TABLE
my_db=> insert into test (no, name, birthday) values (11, 'my name is',
'1990/5/12');
INSERT 0 1
my_db=> select * from test;
no | name | birthday
----+------------+------------
11 | my name is | 1990-05-12
(1 row)
my_db=> select * from test where birthday = '1990-5-12';
no | name | birthday
----+------------+------------
11 | my name is | 1990-05-12
(1 row)
my_db=> select * from test where birthday = 1990-5-12;
no | name | birthday
----+------+----------
(0 rows)
my_db=>
pgsql-jp メーリングリストの案内