Re: BUG #15272: creating an index function terminate with error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: loumour(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15272: creating an index function terminate with error
Date: 2018-07-10 13:58:28
Message-ID: 28790.1531231108@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?utf-8?q?PG_Bug_reporting_form?= <noreply(at)postgresql(dot)org> writes:
> I created the function bellow :

> CREATE OR REPLACE FUNCTION f_unaccent(text) RETURNS text AS $$
> SELECT lower(unaccent('unaccent', $1))
> $$ LANGUAGE sql IMMUTABLE;

> But, when i need to create an index using that function, i have the
> following error:

> dref=# create index geo_test on geoname(upper(f_unaccent(nom))) ;
> ERROR: function unaccent(unknown, text) does not exist

You need to schema-qualify the function name, or else add a SET clause
to force an appropriate search_path setting. PG did not use to be
picky about that, but it is since CVE-2018-1058. In any case, the
old behavior was very dangerous since the index function's behavior
could vary depending on the prevailing search path.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-07-10 17:15:13 BUG #15273: Lexer bug with UESCAPE
Previous Message Ashutosh Bapat 2018-07-10 13:50:47 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation