Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvNJY-0007Mr-ID for pgsql-general@arkaria.postgresql.org; Thu, 30 Aug 2018 13:48:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fvNJW-0001Wv-0s for pgsql-general@arkaria.postgresql.org; Thu, 30 Aug 2018 13:48:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvNJU-0001Wo-VT for pgsql-general@lists.postgresql.org; Thu, 30 Aug 2018 13:48:45 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fvNJI-0000Et-MA for pgsql-general@lists.postgresql.org; Thu, 30 Aug 2018 13:48:44 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DB62221F24; Thu, 30 Aug 2018 09:48:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 30 Aug 2018 09:48:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=A9nzJiYg+cv6vhSWp0iQsRsxwKqH2 g0yofX8Jff3wvg=; b=kkEvOBiM+x1NnnUU2uL6DZcNjrS1/qJXUTDTdBVLfPoVL W793XfjShgSWl5OtbUJUtzuQ/xcVrUuvD+OAEBgO3dbaVxUXdupR4N8RoAqOpLPs pwdTCbO0iQ/N25eQ6QK2FlGm4Zz3Xvf29Q7ZglptJOFpBaMuGbZP68kXV2pXV4xT tCUsZNK/j2YQiHUOYDsHPyAaU3JABghK7Df4dqYXSarjTH/guVbGi80ALJPaZ9Zz x+OA5kzisU9NXvCcjw1C7UxZtye+Ho74v218wiVJcz1oaeojGPiDs4bHpAb/UrMB /ImrSRjZGCCajGi+iOwtpaBPBxaetIxhQVwfo3SwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=A9nzJi Yg+cv6vhSWp0iQsRsxwKqH2g0yofX8Jff3wvg=; b=ES6Nc50I03ne0eqBiCzlt1 nF58fLTQn0PTDU+emoq8NdBOrE34nPfm1mAcOC+m7cOmPXYLzgBTKjbWsRwA1SdR eUGy0vtjyIEae1gA0LinqVqAi9YA+ErBeSxKliu6EmOUi7lVUwKtmWyt42ANbZzj DabXMZ4u/NN4yodMmXmxia6rjJlAXGJ73L0MvTeaDa5OQVxCCpZQvSpUjfAh3iR9 zpFhpjyK2Bn0oVJCC9+RIdc96TmGJT9IQHurEiGWx3z0tgkjImSCeGmjrTzxS92k YGlIGs3sSGIdj/TM7QkGQVC5nOK+pqICCJU68vkiyLqx5WoYMm8RJH8DHRP8s/Pg == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id DA002E47C5; Thu, 30 Aug 2018 09:48:27 -0400 (EDT) Subject: Re: pg_upgrade fails saying function unaccent(text) doesn't exist To: Gunnlaugur Thor Briem , bruce@momjian.us Cc: pgsql-general@lists.postgresql.org References: <20180829190635.GD25450@momjian.us> From: Adrian Klaver Message-ID: <6c73c320-95b7-c259-e309-c46300557852@aklaver.com> Date: Thu, 30 Aug 2018 06:48:26 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/30/2018 02:24 AM, Gunnlaugur Thor Briem wrote: > Thank you! That got the pg_upgrade to completion. But then during > ./analyze_new_cluster.sh vacuum fails thus: > > vacuumdb: processing database "dm_test": Generating minimal optimizer > statistics (1 target) > vacuumdb: vacuuming of database "dm_test" failed: ERROR:  text search > dictionary "unaccent" does not exist > CONTEXT:  SQL function "semantic_normalize" statement 1 > > And yet a text search dictionary with that name does exist: > > $ psql -d dm_test -c '\dFd+ unaccent' >                     List of text search dictionaries >  Schema |   Name   |    Template     |    Init options    | Description > --------+----------+-----------------+--------------------+------------- >  public | unaccent | public.unaccent | rules = 'unaccent' | > (1 row) > > Running VACUUM ANALYZE semantic_mapping in psql works: > > $ psql -d dm_test -c 'VACUUM ANALYZE semantic_mapping' > VACUUM > Time: 1231,767 ms (00:01,232) > > But running it with the vacuumdb command doesn't: > > vacuumdb -z -t semantic_mapping dm_test > vacuumdb: vacuuming database "dm_test" > vacuumdb: vacuuming of table "semantic_mapping" in database "dm_test" > failed: ERROR:  text search dictionary "unaccent" does not exist > CONTEXT:  SQL function "semantic_normalize" statement 1 > > This is presumably a similar search path problem, because I can > reproduce this in psql by setting the search path to exclude public: > > set search_path to "$user"; > vacuum analyze public.semantic_mapping; > ERROR:  text search dictionary "unaccent" does not exist > CONTEXT:  SQL function "semantic_normalize" statement 1 > Time: 851,562 ms > > Can't find a place to poke the "public." prefix in to work around this > ... I can't even see where it's getting the link to the text search > dictionary from. Is that in native code in the unaccent extension? Since the semantic_normalize function is tripping it and it uses unaccent I would say it is native to the extension. What does: \dFd unaccent show? > > The unaccent definition looks like this: > > \df+ public.unaccent >                                                                               List of functions >  Schema |   Name   | Result data type | Argument data types |  Type  | > Volatility | Parallel | Owner | Security | Access privileges | Language > |  Source code  | Description > --------+----------+------------------+---------------------+--------+------------+----------+-------+----------+-------------------+----------+---------------+------------- >  public | unaccent | text             | regdictionary, text | normal | > stable     | safe     | gthb  | invoker  |                   | c > | unaccent_dict | >  public | unaccent | text             | text                | normal | > stable     | safe     | gthb  | invoker  |                   | c > | unaccent_dict | > (2 rows) > > Any tips? > > Cheers, > Gulli > > On Wed, Aug 29, 2018 at 7:06 PM Bruce Momjian > wrote: > > On Wed, Aug 29, 2018 at 06:09:53PM +0000, Gunnlaugur Thor Briem wrote: > > Hi, > > > > I'm trying to upgrade an old PG 9.4 cluster to PG 10, and it's > failing on > > creating an index that uses the unaccent(text) function. > > > > That function is part of the unaccent extension, which is > installed in the old > > DB cluster. I expect pg_upgrade to create that extension as part > of the > > upgrade. It does create other extensions that are installed in > the old DB > > cluster. I don't get why this one isn't included. > > This is caused by security changes made in PG 10.3 and other minor > releases.  Please see this thread for an outline of the issue: > > https://www.postgresql.org/message-id/flat/152106914669.1223.5104148605998271987%40wrigleys.postgresql.org > > I think you have to change your index function to specify the schema > name before the unacces function call, e.g. > >         SELECT lower(public.unaccent(btrim(regexp_replace( > > -- >   Bruce Momjian  > > http://momjian.us >   EnterpriseDB http://enterprisedb.com > > + As you are, so once was I.  As I am, so you will be. + > +                      Ancient Roman grave inscription + > -- Adrian Klaver adrian.klaver@aklaver.com