PostgreSQL難しい

# select count(*) from table where to_date('20040101','YYYMMDD') -1 >to_date('20040101','YYYMMDD');
count

            • -

0
(1 row)

# select count(*) from table where ( (to_date(foo_date ,'YYYYMMDD')+ bar_num) ) < to_date( '20040101' ,'YYYYMMDD');
ERROR: operator does not exist: date + numeric
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.

数字の直書きは、OKで、カラムで指定すると、NG。
う〜ん。