Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan? - Mailing list pgsql-general

From Joe Van Dyk
Subject Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan?
Date
Msg-id CACfv+p+aO1hwi+YjN7Gw8Vcpwn3_LLzQSAN0HhwVu4EuP4hO=w@mail.gmail.com
Whole thread Raw
Responses Re: Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan?
List pgsql-general
I had a function that was set to SECURITY INVOKER. I needed to give access to a view that uses this function to a role, so I made the function SECURITY DEFINER.

The function is STABLE and is usually inlined and takes 2 ms to run.

Immediately, the function quit being inlined and took 1500ms to run.

Changing the function back to SECURITY DEFINER let the function be inlined again.

On postgresql 9.3.1.

Is this expected behavior? 

pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Primary Key
Next
From: Tom Lane
Date:
Subject: Re: Changing function from SECURITY DEFINER to SECURITY INVOKER changes query plan?