OSDN Git Service

Don't reset plpgsql nest level at every command end
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Tue, 4 Dec 2018 01:33:55 +0000 (10:33 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Wed, 5 Dec 2018 08:31:48 +0000 (17:31 +0900)
commitc9864a4b043d9a127167ab2393758e45a744ba88
tree2b9ba0e701cf5b740127d6ad18319f5785bb1186
parent016029553f36d017d2362caaa8ddf623b8bc8a62
Don't reset plpgsql nest level at every command end

Clean up code for global exit is forgetting about loops that run
hinted commands multiple times. This leads to pg_hint_plan's failure
to affect after the first execution of the inner commands.
The hint below worked only for the first time.

FOR outer IN EXECUTE 'outer-command' LOOP
  FOR inner IN EXECUTE '/*+ hint */ inner-command' LOOP
    <something>
  END LOOP;
END LOOP;
expected/pg_hint_plan.out
pg_hint_plan.c
sql/pg_hint_plan.sql