BACHELART PIERRE (CIS/SCC) <[email protected]> wrote:
> Hello,
>
>
>
>
>
> Why is my sql below accepted in 8.1.19 and refused in 8.4.9 ???
>
> Welcome to psql 8.1.19, the PostgreSQL interactive terminal.
>
> ansroc=# select * from s12hwdb where record ~'2012-09-20' limit 5;
>
>
> psql (8.4.9)
>
>
> ERROR: operator does not exist: timestamp without time zone ~ unknown
>
> LINE 1: select * from s12hwdb where record ~'2012-09-20' limit 5;
>
Because of the dropped implicid casts since IIRC 8.2.
You have to rewrite your query to:
select * from s12hwdb where record::date = '2012-09-20'::date limit 5;
(assuming record is a TIMESTAMP-Field)
Short example:
test=# select now() ~ '2012-09-22';
ERROR: operator does not exist: timestamp with time zone ~ unknown
LINE 1: select now() ~ '2012-09-22';
^
HINT: No operator matches the given name and argument type(s). You might need
to add explicit type casts.
Time: 0,156 ms
test=!# rollback;
ROLLBACK
Time: 0,079 ms
test=# select now()::date = '2012-09-22'::date;
?column?
----------
t
(1 row)
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql