pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: Postgres General <pgsql-general@postgresql.org>
Subject: moving a database to a new 15.1 server
Date: Wed, 1 Feb 2023 13:24:34 +0100
Message-ID: <20230201122434.GB9@sh4-5.1blu.de> (raw)

Hello,

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?

	matthias



-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub





view thread (3+ messages)  latest in thread

Message-ID: <20230201122434.GB9@sh4-5.1blu.de>
Permalink:  ../20230201122434.GB9@sh4-5.1blu.de/
Also on:    postgresql.org/message-id/20230201122434.GB9@sh4-5.1blu.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: guru@unixarea.de
  Subject: Re: moving a database to a new 15.1 server
  In-Reply-To: <20230201122434.GB9@sh4-5.1blu.de>
  References: <20230201122434.GB9@sh4-5.1blu.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox