You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allows a callback to be triggered on every notice sent by PostgreSQL.
Such notices can be sent with a RAISE NOTICE in PL/pgSQL; in a long running
stored procedure, they prove useful as realtime checkpoint indicators.
closeGH-6764
$db->exec("create temporary table t (a varchar(3))");
11
+
$db->exec("create function hey() returns trigger as \$\$ begin new.a := 'oh'; raise notice 'I tampered your data, did you know?'; return new; end; \$\$ language plpgsql");
12
+
$db->exec("create trigger hop before insert on t for each row execute procedure hey()");
13
+
$db->exec("insert into t values ('ah')");
14
+
attach($db, 'Re');
15
+
$db->exec("delete from t");
16
+
$db->exec("insert into t values ('ah')");
17
+
$db->pgsqlSetNoticeCallback(null);
18
+
$db->exec("delete from t");
19
+
$db->exec("insert into t values ('ah')");
20
+
var_dump($db->query("select * from t")->fetchAll(PDO::FETCH_ASSOC));
0 commit comments