"yotsunaga.na...@fujitsu.com" <yotsunaga.na...@fujitsu.com> writes:
> I did the following.
> Even though I accessed one partition table(test2 table), I also acquired 
> locks on other partition tables(test1 table).
> I expected to acquire locks on the parent table(test table) and the partition 
> table to access(test2 table).
> Why does this happen?

You specified a generic plan:

> postgres=# set plan_cache_mode = force_generic_plan ;

so you are not going to get any plan-time optimization based on knowing
the id parameter.  Therefore the plan must include sub-plan nodes for
every child table, so executing it requires locking all those tables
to make sure their schemas haven't changed.

                        regards, tom lane


Reply via email to