From: | Erik Wienhold <ewie(at)ewie(dot)name> |
---|---|
To: | Matthias Apitz <guru(at)unixarea(dot)de>, Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: moving a database to a new 15.1 server |
Date: | 2023-02-01 12:38:11 |
Message-ID: | 1195302395.96549.1675255091214@office.mailbox.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On 01/02/2023 13:24 CET Matthias Apitz <guru(at)unixarea(dot)de> wrote:
>
> The source database in the 12.11 server shows this:
>
> $ psql -Ulbs_lbsoclc01_dev_r1_dbo_u $DATABASE
> psql (12.11)
> Type "help" for help.
>
> lbs_lbsoclc01_dev_r1=>
> lbs_lbsoclc01_dev_r1=> \d
> List of relations
> Schema | Name | Type | Owner
> --------+-------------------------------+-------+----------------------------
> dbo | accession_index | table | lbs_lbsoclc01_dev_r1_dbo_u
> dbo | acq_bind | table | lbs_lbsoclc01_dev_r1_dbo_u
> ...
>
> I dumped this with pg_dump
>
> $ pg_dump --file=dmp.gz --compress=9 --dbname=$DATABASE
>
> Created in the new server the database
>
> $ createdb -U lbs_lbsoclc01_dev_r1_dbo_u -T template0 lbs_lbsoclc01_dev_r1
>
> and the role for thw user with
>
> CREATE ROLE lbs_lbsoclc01_dev_r1_dbo_u WITH SUPERUSER CREATEDB LOGIN PASSWORD 'xxxxxx' ;
> CREATE ROLE
>
> and loaded the dump with
>
> $ gzip -dc dmp.gz | psql -U lbs_lbsoclc01_dev_r1_dbo_u lbs_lbsoclc01_dev_r1
>
> This all went fine. But when I now look into the database:
>
> $ psql -Ulbs_lbsoclc01_dev_r1_dbo_u lbs_lbsoclc01_dev_r1
> psql (15.1)
> Type "help" for help.
>
> lbs_lbsoclc01_dev_r1=#
> lbs_lbsoclc01_dev_r1=# \d
> Did not find any relations.
> lbs_lbsoclc01_dev_r1=# \d dbo.accession_index
> Table "dbo.accession_index"
> Column | Type | Collation | Nullable | Default
> ------------------+-----------------------+-----------+----------+---------
> iln | smallint | | not null |
>
> lbs_lbsoclc01_dev_r1=# select count(*) from counter;
> ERROR: relation "counter" does not exist
> LINE 1: select count(*) from counter;
> ^
> lbs_lbsoclc01_dev_r1=# select count(*) from dbo.counter;
> count
> -------
> 41
>
> i.e. I have to specify the schema 'dbo' to access the tables.
>
> What I am missing here in this move?
Your search_path does not contain dbo. Check SHOW search_path; in the old
database and set the search_path with ALTER DATABASE in the new database accordingly.
--
Erik
From | Date | Subject | |
---|---|---|---|
Next Message | Wiwwo Staff | 2023-02-01 14:09:20 | pg_rewind and replication user |
Previous Message | Thomas Kellerer | 2023-02-01 12:35:00 | Re: moving a database to a new 15.1 server |