In REFRESH MATERIALIZED VIEW, set user ID before running user code.

Noah Misch <noah@leadboat.com>

Commit: 88743d581e1bdedc13e4ca33c5a6597a5d2dbdc4
Author: Noah Misch <noah@leadboat.com>
Date: 2022-05-09T15:35:12Z
Releases: 13.7
In REFRESH MATERIALIZED VIEW, set user ID before running user code.

It intended to, but did not, achieve this.  Adopt the new standard of
setting user ID just after locking the relation.  Back-patch to v10 (all
supported versions).

Reviewed by Simon Riggs.  Reported by Alvaro Herrera.

Security: CVE-2022-1552

Files