Fix superuser concurrent refresh of matview owned by another.

Kevin Grittner <kgrittn@postgresql.org>

Commit: 06414c0f68e9f8039c1de40d009f12fa96c49192
Author: Kevin Grittner <kgrittn@postgresql.org>
Date: 2014-08-26T15:00:42Z
Releases: 9.4.0
Fix superuser concurrent refresh of matview owned by another.

Use SECURITY_LOCAL_USERID_CHANGE while building temporary tables;
only escalate to SECURITY_RESTRICTED_OPERATION while potentially
running user-supplied code.  The more secure mode was preventing
temp table creation.  Add regression tests to cover this problem.

This fixes Bug #11208 reported by Bruno Emanuel de Andrade Silva.

Backpatch to 9.4, where the bug was introduced.

Files