mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
a1b9b14cc8
Oversight in commit 418ec3207
: it's better to do it like this,
else you have to drop and recreate the extension for each
permutation. tcn.spec only has one permutation at present,
so this doesn't speed it up any, but it's still a bad example.
29 lines
789 B
Python
29 lines
789 B
Python
# Tests for contrib/tcn
|
|
|
|
# These tests use only self-notifies within a single session,
|
|
# which are convenient because they minimize timing concerns.
|
|
# Whether the NOTIFY mechanism works across sessions is not
|
|
# really tcn's problem.
|
|
|
|
setup
|
|
{
|
|
CREATE TABLE mytable (key int PRIMARY KEY, value text);
|
|
CREATE TRIGGER tcntrig AFTER INSERT OR UPDATE OR DELETE ON mytable
|
|
FOR EACH ROW EXECUTE FUNCTION triggered_change_notification(mychannel);
|
|
}
|
|
|
|
teardown
|
|
{
|
|
DROP TABLE mytable;
|
|
}
|
|
|
|
session s1
|
|
step listen { LISTEN mychannel; }
|
|
step insert { INSERT INTO mytable VALUES(1, 'one'); }
|
|
step insert2 { INSERT INTO mytable VALUES(2, 'two'); }
|
|
step update { UPDATE mytable SET value = 'foo' WHERE key = 2; }
|
|
step delete { DELETE FROM mytable; }
|
|
|
|
|
|
permutation listen insert insert2 update delete
|