public inbox for [email protected]
help / color / mirror / Atom feedFrom: Sam Son <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: Muhammad Usman Khan <[email protected]>
Cc: [email protected]
Subject: Re: Issue with Restore dump with plpythonu, plpython3u installed on postgres16
Date: Wed, 4 Sep 2024 16:18:00 +0530
Message-ID: <CACW-z_Xunr6cKL89h-uOE1sfvJ0E0thL+5k6NwT+B-PNq_=_=g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CACW-z_UwPK8RP68ijs5Frn4+iREOSrN99-KFH6g0v3pFVVF1+w@mail.gmail.com>
<CAPnRvGu-7B7J1i624KcJ-V2nUkuqGLsDT4Ae=EGbAPXJ=8A4fQ@mail.gmail.com>
<[email protected]>
<[email protected]>
Hi Adrian, Muhammad,
Thanks for the quick response.
For new I cannot do changes in old version DB, since it is deployed
remotely and i dont have any access. And it has to be done from multiple
servers.
As a work around I tried two solutions.
*Solution 1:*
After downloading and extracting the dump, convert the pgdump file to sql
file which is editable.
* pg_restore -f out_dump.sql dump.pgdump*
Replace all the plpythonu references with plputhon3u.
Restore using the sql file.
* sudo -H -u postgres psql -p 5433 -d db_name < out_dump.sql*
*Solution 2:*
After downloading and extracting the dump, get the list of items in dump
(Schemas, tables, table data, Index, functions, etc).
* pg_restore -l dump.pgdump > dump.txt*
Delete all the function references which have plpython3u.
Create a sql file which has functions with plpython3u extensions.
Load the sql file to db
* sudo -H -u postgres psql -p 5433 -d db_name < func.sql*
Now restore the dump with only the items in the edited dump.txt file
(Functions with plpython3u extensions removed).
* sudo -H -u postgres pg_restore -p 5433 -j 8 --disable-triggers
--no-privileges -L dump.txt -d db_name dump.pgdump *
*Question:*
Our database size is 500GB,
Do we see any performance impact using solution 1. Since solution 1 is
using sql file load and solution 2 is using pg_restore directly.
Kindly recommend what to choose, solution 1 or solution 2 or any other
workaround to restore.
Thanks,
Samson G
On Tue, Sep 3, 2024 at 10:31 PM Adrian Klaver <[email protected]>
wrote:
> On 9/3/24 09:37, Adrian Klaver wrote:
> > On 9/3/24 09:25, Muhammad Usman Khan wrote:
> >> Hi,
> >> You need to install plpython3u on your new server and also make sure
> >> to use python3. You need to make changes to your functions also to
> >> make them compatible with python3
> >
> > That only works if the dump from the old server is outputting
> > plpython3u. If the plpythonu is the only version installed on the old
> > server then that is what will be in the dump file. As of Postgres 15
> > plpythonu is no longer available:
> >
> > https://www.postgresql.org/docs/15/plpython-python23.html
> >
> > This means if you are moving to 15+ you can't have any references to
> > plpythonu.
> >
>
> In previous post I should have added:
>
> https://www.postgresql.org/docs/15/release-15.html
>
>
> Remove server-side language plpython2u and generic Python language
> plpythonu (Andres Freund)
>
> Python 2.x is no longer supported. While the original intent of
> plpythonu was that it could eventually refer to plpython3u, changing it
> now seems more likely to cause problems than solve them, so it's just
> been removed.
>
>
> Adrian Klaver
> [email protected]
>
>
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Issue with Restore dump with plpythonu, plpython3u installed on postgres16
In-Reply-To: <CACW-z_Xunr6cKL89h-uOE1sfvJ0E0thL+5k6NwT+B-PNq_=_=g@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox