On Sat, Aug 11, 2018 at 12:47:05PM -0700, Noah Misch wrote: > -- (3) "SET search_path" with today's code. > -- > -- Security and reliability considerations are the same as (2). Today, this > -- reduces performance by suppressing optimizations like inlining.
Out of curiosity, why does this suppress inlining? Anyways, my preference would be to have syntax by which to say: resolve at declaration time using the then-in-effect search_path and store as-qualified. This could just be SET search_path without an assignment. CREATE FUNCTION ... AS $$ ... $$ SET search_path; Another possibility would be to have a way to set a search_path for all expressions in a given schema, something like: SET SCHEMA my_schema DEFAULT search_path = ...; which would apply to all expressions in schema elements in schema "my_schema": - CHECK expressions - INDEX expressions - VIEWs and MATERIALIZED VIEWs - FUNCTION and STORED PROCEDURE bodies - ... CREATE SCHEMA IF NOT EXISTS my_schema; SET SCHEMA my_schema DEFAULT search_path = my_schema, my_other_schema; CREATE OR REPLACE FUNCTION foo() ... AS $$ ... $$; ... Nico --