Re: BUG #14649: Function Namespace Resolution Bug

From: Jeremy Cowgar <jeremy(at)cowgar(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14649: Function Namespace Resolution Bug
Date: 2017-05-12 18:25:23
Message-ID: C85A4615-B255-4D73-B0E2-774980C542A8@cowgar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Why does it find the initial function just fine in the public namespace, but the method it calls it can not find, which is in the same namespace as the calling function?

Jeremy Cowgar

> On May 12, 2017, at 2:13 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> jeremy(at)cowgar(dot)com writes:
>> In short, when a CHECK on a column in a different schema references a
>> function in public that references another function in public implicitly,
>> there is confusion. The workaround is to prefix the function calls with the
>> schema.
>
> I don't see any PG bug here. If you don't schema-qualify the function
> reference, then it is dependent on the current search_path, and pg_dump/
> pg_restore have their own ideas about how to set search_path. Even if
> those two somehow magically intuited what search_path you're expecting,
> this coding would still be fragile since some other user might use a
> different search_path than you while accessing the table. The schema
> qualification isn't a "workaround", it's just good coding practice.
>
> regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-05-12 18:50:50 Re: BUG #14649: Function Namespace Resolution Bug
Previous Message Tom Lane 2017-05-12 18:22:20 Re: BUG #14650: pg_dump -c fails when 'public' schema doesn't exist