Postgresql subquery execution within ON UPDATE rule (maybe bug in postgresql?)
问题 I am running into a strange behavior (or is this a bug within postgresql?) within postgresql's execution order of subqueries within rules. Consider the following SQL: BEGIN; CREATE OR REPLACE FUNCTION debug(anyelement) RETURNS bool AS $$ pg_raise('notice', 'debug(): ' . json_encode($args[0])); RETURN TRUE; $$ LANGUAGE PLPHP IMMUTABLE STRICT; CREATE TABLE foo_table (c1 text); CREATE OR REPLACE RULE foo_update_rule AS ON UPDATE TO foo_table DO INSTEAD ( WITH foobar_update AS ( SELECT unnest('{a