PostgreSQL: Select data with a like on timestamp field -
i trying select data table, using "like" on date field "date_checked" (timestamp). have error :
sqlstate[42883]: undefined function: 7 error: operator not exist: timestamp without time zone
my request :
select my_table.id my_table my_table.date_checker '2011-01-%'
i don't want use :
select my_table.id my_table my_table.date_checker >= '2011-01-01 00:00:00' , my_table.date_checker < '2011-02-01 00:00:00'
it's not "wanting use" < , > timestamps, operators can converted index scans, , string-match... well, can, ewwww.
well, error occurring because need explicitly convert timestamp string before using string operation on it, e.g.:
date_checker::text '2011-01-%'
and suppose create index on (date_checker::text)
, expression become index scan but.... ewwww.
Comments
Post a Comment