Re: pg_dump does not honor namespaces when functions are used in index - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump does not honor namespaces when functions are used in index
Date
Msg-id 3959.1276787300@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_dump does not honor namespaces when functions are used in index  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: pg_dump does not honor namespaces when functions are used in index  (Greg Stark <gsstark@mit.edu>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> I suppose that the root of the problem here is that foo() is not
> really immutable - it gives different results depending on the search
> path.

Yeah.  The declaration of the function is broken --- it's not pg_dump's
fault that the function misbehaves.

> I actually wonder if we shouldn't automatically tag plpgsql functions
> with the search_path in effect at the time of their creation (as if
> the user had done ALTER FUNCTION ... SET search_path=...whatever the
> current search path is...).

That would be extremely expensive and not very backwards-compatible.
In the case at hand, just writing "RETURN bar.bar();" would be the
best-performing solution.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: ANNOUNCE list (was Re: New PGXN Extension site)
Next
From: Tom Lane
Date:
Subject: Re: Should the JSON datatype be a specialization of text?