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 1iUuPQ-0001Mr-CF for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Nov 2019 15:18:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iUuPO-0007q4-RV for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Nov 2019 15:18:14 +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 1iUuPO-0007pv-GG for pgsql-bugs@lists.postgresql.org; Wed, 13 Nov 2019 15:18:14 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iUuPH-0000QA-TJ for pgsql-bugs@lists.postgresql.org; Wed, 13 Nov 2019 15:18:13 +0000 Received: by mail-wm1-x341.google.com with SMTP id z19so2440474wmk.3 for ; Wed, 13 Nov 2019 07:18:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=qdoSIUl8AaPgZmGQw2RziM3z6pkLDYhBdXWOzw8++mA=; b=2FSeFiojZFGCfMB0AxHrDZSPLoPcOfgH3owz24ZjzTdMhHk2aMOL0TmKC/DSag3XDR uyoUQCbxOWTiKXO45cTcpwWHGJc3kD0w/uAvw9clXmUbx8y0jRmkqn88+a8Ieh0hC6q/ zLKkUn5hrH4pyRn4u/pWY/SWz/5o8aVMakwUloRg2QcYDXkfKuvnsAyXvTgKOiQr/1f3 zOSch4WyGx3mKbTooZQ+/jdJ9qCM+2TepUF3jrX5jSfoAwgD0H/+uxs8rGyRybpB+/L4 bX1fnDZRoLlRmNUvx6Ep6ziua4/moKJ/vPsPwvyWGwD4ckF5+PDmoFXUxfsUeBgYm0Uo y60w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=qdoSIUl8AaPgZmGQw2RziM3z6pkLDYhBdXWOzw8++mA=; b=QlGIBMPMZ68GylAQpk4kZ5HKzlXdQ+dPkB6TNZcxhw8mxjaIyRydT6GifcZVsrUcdg c8NNtFa2zjkhgyt4Ok4FcPH4uUmQfC5Y0wSFsejr4ezYsO7ERIEgSe/ejb6Tyh1apPjH Uv6KlSa+VNahfvRSZUwi2F7fECBOaCNpdZLMJEVArN3mJwFTRZxbVB8FegnvQfmCyZyo 8DuMEpN6Y+HVWu7/B0oI5iNWzlZTkZu17VsoD/9WPrsO14VYeRM5/qMoxMqpEQCG3NjN kVHC//NUgixPv3E+ZsBubtbXXWQzAsgLj7bIbgMFlOHAYqZ2iFfnfUeUdZ+gUUdymYME g21Q== X-Gm-Message-State: APjAAAVWex2SALYd+fNf3P17QZ+swvW6HOGrSB+1vdpTPiuJ7ukNdDAo IAyoT7GJqNlZx3BTCkCQfGI2uA== X-Google-Smtp-Source: APXvYqy3MfuE32mefAi6b/IX0+pzOHWt22pRLmV5oUfIJkglIu1xOzDeaGBs+I1fuj8dw5FEk3cu4A== X-Received: by 2002:a1c:1d48:: with SMTP id d69mr3079667wmd.160.1573658286485; Wed, 13 Nov 2019 07:18:06 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id a5sm3023863wrv.56.2019.11.13.07.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2019 07:18:04 -0800 (PST) Date: Wed, 13 Nov 2019 16:18:03 +0100 From: Tomas Vondra To: =?utf-8?B?5ZSv5LiA4piF?= <270246512@qq.com> Cc: pgsql-bugs Subject: Re: =?utf-8?B?5Zue5aSN77yaICDlm57lpI3vvJogQlU=?= =?utf-8?Q?G?= #16101: tables in the DB is not available after pg_restore Message-ID: <20191113151803.6ye47vh3vyp5ufah@development> References: <16101-5a569e5aac6aa84e@postgresql.org> <20191108111339.xlopjkbwfhxfvwt3@development> <20191113133029.kagiy6vjjeoguatp@development> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Nov 13, 2019 at 10:43:20PM +0800, 唯一★ wrote: >hi,  > > >The restore command is "pg_dump -h 127.0.0.1 -U postgres -d cmdb -p 5432 -Fc -f bk_1" >Here are reproduce steps. >1. login in the postgres DB with super user postgres and create DB > CREATE DATABASE cmdb OWNER cm WITH TEMPLATE = template0; > GRANT ALL PRIVILEGES ON DATABASE cmdb to cm; > > > >2.pop the data to DB. > pgbench -i -h 127.0.01 -U cm -s 20 -d cmdb > > >3.use the pg_dump to backup the data. > pg_dump -h 127.0.0.1 -U postgres -d cmdb -p 5432 -Fc -f bk_1 >4.take the restore via pg_restore. > pg_restore -h 127.0.0.1 -U postgres -d cmdb bk_1 -c -v > Works just fine for me: [user@development ~]$ pg_ctl -D tmp/data init ... [user@development ~]$ pg_ctl -D tmp/data -l pg.log start waiting for server to start.... done server started [user@development ~]$ createdb cmdb [user@development ~]$ pgbench -i -s 1 cmdb dropping old tables... NOTICE: table "pgbench_accounts" does not exist, skipping NOTICE: table "pgbench_branches" does not exist, skipping NOTICE: table "pgbench_history" does not exist, skipping NOTICE: table "pgbench_tellers" does not exist, skipping creating tables... generating data... 100000 of 100000 tuples (100%) done (elapsed 0.06 s, remaining 0.00 s) vacuuming... creating primary keys... done. [user@development ~]$ pg_dump -d cmdb -p 5432 -Fc -f bk_1 [user@development ~]$ pg_restore -d cmdb2 bk_1 -c -v pg_restore: connecting to database for restore ... pg_restore: warning: errors ignored on restore: 7 [user@development ~]$ psql cmdb2 psql (12.1) Type "help" for help. cmdb2=# \d List of relations Schema | Name | Type | Owner --------+------------------+-------+------- public | pgbench_accounts | table | user public | pgbench_branches | table | user public | pgbench_history | table | user public | pgbench_tellers | table | user (4 rows) Are you sure you're running the pg_restore on the right machine and not on the same system where you did the pg_dump? Don't you have some per-user search_path setting applied using ALTER USER? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services