Re: [GENERAL] date - null casted to integer?

2009-03-03 Thread Роман Маширов
Ups, sorry, I'm idiot... changes from the default casting to text is 
really helpful in clearing brain bugs...


Роман Маширов wrote:

Hi!

Excuse me, if this been discussed before, but following thing seems to 
me a little bit strange:


select '2009-01-12'::date - null::date  '1 day'::interval;
ERROR:  operator does not exist: integer  interval
LINE 1: select '2009-11-12'::date - null::date  '1 day'::interval;
  ^
HINT:  No operator matches the given name and argument type(s). You 
might need to add explicit type casts.


select ('2009-11-12'::date - null::date)::interval  '1 day'::interval;
ERROR:  cannot cast type integer to interval
LINE 1: select ('2009-11-12'::date - null::date)::interval  '1 day'...

server 8.3.5 It's really not a problem in queries, but could became a 
real pain with plpgsql. I'm not sure, but it seems to me that any 
operation with null should product null from the standart's point of 
view?


Thank you beforehand
--
MRJ






--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] date - null casted to integer?

2009-03-03 Thread Роман Маширов

Hi!

Excuse me, if this been discussed before, but following thing seems to 
me a little bit strange:


select '2009-01-12'::date - null::date  '1 day'::interval;
ERROR:  operator does not exist: integer  interval
LINE 1: select '2009-11-12'::date - null::date  '1 day'::interval;
  ^
HINT:  No operator matches the given name and argument type(s). You 
might need to add explicit type casts.


select ('2009-11-12'::date - null::date)::interval  '1 day'::interval;
ERROR:  cannot cast type integer to interval
LINE 1: select ('2009-11-12'::date - null::date)::interval  '1 day'...

server 8.3.5 It's really not a problem in queries, but could became a 
real pain with plpgsql. I'm not sure, but it seems to me that any 
operation with null should product null from the standart's point of view?


Thank you beforehand
--
MRJ



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general