除了在 INSERT/UPDATE 期间忽略查询给定值以支持默认值的触发器之外,还有其他实用方法吗?
这是我要存档的行为:
CREATE TABLE foo (id serial, data text);
INSERT INTO foo (data) VALUES('bar1');
INSERT INTO foo (id, data) VALUES(50, 'bar2');
INSERT INTO foo (id, data) VALUES(-34, 'bar3');
INSERT INTO foo (id, data) VALUES(80.34, 'bar4');
INSERT INTO foo (id, data) VALUES('foo5', 'bar5');
INSERT INTO foo (data) VALUES('bar6');
UPDATE foo SET id=200, data='BARn' WHERE íd=6;
SELECT * FROM foo;
+----+------+
| id | data |
+----+------+
| 1 | bar1 |
| 2 | bar2 |
| 3 | bar3 |
| 4 | bar4 |
| 5 | bar5 |
| 6 | BARn |
+----+------+
谢谢!