Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iBFQ2-0001nV-RB for pgsql-admin@arkaria.postgresql.org; Fri, 20 Sep 2019 09:41:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iBFQ1-0004OJ-Mh for pgsql-admin@arkaria.postgresql.org; Fri, 20 Sep 2019 09:41:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iBFQ1-0004OA-A0 for pgsql-admin@lists.postgresql.org; Fri, 20 Sep 2019 09:41:37 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iBFPx-0008FG-T2 for pgsql-admin@lists.postgresql.org; Fri, 20 Sep 2019 09:41:36 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.15.2/8.15.2/Debian-8) with ESMTPS id x8K9fOLd024551 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 20 Sep 2019 12:41:29 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id x8K9fOgC055040 for ; Fri, 20 Sep 2019 12:41:24 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Subject: Re: Pg_upgrade error could not load library from 7.14/8.4 to 10.10 version To: pgsql-admin@lists.postgresql.org References: <4519fdad-d747-cd39-f6a2-33e7db1f3324@matrix.gatewaynet.com> <22046.1568901429@sss.pgh.pa.us> From: Achilleas Mantzios Message-ID: <13f3ecf4-248e-eb80-3906-fd2defe8a443@matrix.gatewaynet.com> Date: Fri, 20 Sep 2019 12:41:24 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Virus-Scanned: clamav-milter 0.100.3 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-28.4 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,TW_PG,URI_NOVOWEL autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 20/9/19 12:22 μ.μ., Ekaterina Amez wrote: > Hi Achilleas, > > El 20/9/19 a las 9:26, Achilleas Mantzios escribió: >> Just tested in my 11 and 10 : >> dynacom=# select proname,probin,pronamespace from pg_proc where proname='plpgsql_call_handler'; >>        proname        |             probin              | pronamespace >> ----------------------+---------------------------------+-------------- >>  plpgsql_call_handler | $libdir/plpgsql |           11 >>  plpgsql_call_handler | /usr/local/pgsql/lib/plpgsql.so | 2200 >> (2 rows) >> >> with 2200 being the public namespace/schema. >> >> I my case, in every postgresql installation since 2001, always libdir was /usr/local/pgsql/lib/ , so maybe this problem could not be manifested. Did you check to see if you have the >> plpgsql_call_handler defined in two schemas as well? >> >> -- >> Achilleas Mantzios >> IT DEV Lead >> IT DEPT >> Dynacom Tankers Mgmt > > > I've restored template1 in v8.4, and created again the db where I will be restoring v7.14 backup > > newdb=# select proname,probin,pronamespace from pg_proc where proname='plpgsql_call_handler'; >  proname | probin | pronamespace > ---------+--------+-------------- > (0 filas) > > > And in v10.10 (which is still an empty installation) > > template1=# select proname,probin,pronamespace from pg_proc where proname='plpgsql_call_handler'; > >        proname        |     probin      | pronamespace > ----------------------+-----------------+-------------- >  plpgsql_call_handler | $libdir/plpgsql |           11 > (1 row) > > > After restoring backup in v8.4: > > newdb=# select proname,probin,pronamespace from pg_proc where proname='plpgsql_call_handler'; >        proname        |                 probin                 | pronamespace > ----------------------+----------------------------------------+-------------- >  plpgsql_call_handler | $libdir/plpgsql |           11 >  plpgsql_call_handler | /usr/lib/postgresql/8.4/lib/plpgsql.so |         2200 > (2 filas) > > As you said, 2200 is public namespace/schema and 11 is pg_catalog. > > > At the beginning of the backup file I can find these sentences: > > CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler >     LANGUAGE c >     AS '/usr/lib/postgresql/8.4/lib/plpgsql.so', 'plpgsql_call_handler'; <-- I've changed this line to use the right path to plpgsql.so library > > CREATE PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler; > > I guess these are the ones causing all of this. **What should be the best way to handle this situation?** Remove these lines and create the language explicitly when creating database? Just drop the 2nd function (in the public schema) : drop function public.plpgsql_call_handler ( ) ; and see pg_upgrade goes from there. > Or replace them with a create language sentence? Maybe something else? My final goal is migrate from 7.14 server to 8.4 server and after that (if I have an OK from the boss) upgrade 8.4 to the > latest version that I can use. Server uses CentOS, and probably I won't be able to upgrade to v10 but I hope at least 9.5/9.6 will be available. > > > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt