New answers tagged

1

The basic misunderstanding is that you assume variable substitution for an SQL utility command like ALTER TABLE, which is not implemented. Equally not possible to pass values for utility commands to EXECUTE with the USING clause in plpgsql. Detailed explanation for both in this related answer on SO: Error when setting n_distinct using a plpgsql variable ...


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; +------+------------+...



Top 50 recent answers are included