New answers tagged

3

Use a trigger: mysql> CREATE TRIGGER dateinsert BEFORE INSERT ON testtable -> FOR EACH ROW -> SET NEW.yourdate = DATE_ADD(CURRENT_TIMESTAMP(),INTERVAL 10 DAY); Query OK, 0 rows affected (0.00 sec) mysql> insert into testtable (blah) values (1); Query OK, 1 row affected (0.00 sec) mysql> select * from testtable; +------+------------+...


0

The WHERE expression does not make sense: WHERE date_trunc('day',NOW() - interval '1 day' It has to evaluate to a boolean value and you need to compare to an actual column of the table like (assuming a timestamp , timestamptz or date column): WHERE my_timestamp_column >= (NOW()::date - 1) AND my_timestamp_column < NOW()::date Postgres does ...



Top 50 recent answers are included