Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aczRK-0005bv-Sx for pgsql-admin@arkaria.postgresql.org; Mon, 07 Mar 2016 17:59:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aczRK-0005O3-Ab for pgsql-admin@arkaria.postgresql.org; Mon, 07 Mar 2016 17:59:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aczRJ-0005Nx-Td for pgsql-admin@postgresql.org; Mon, 07 Mar 2016 17:59:30 +0000 Received: from mail-oi0-x230.google.com ([2607:f8b0:4003:c06::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aczRH-0000fu-FH for pgsql-admin@postgresql.org; Mon, 07 Mar 2016 17:59:28 +0000 Received: by mail-oi0-x230.google.com with SMTP id r187so84834948oih.3 for ; Mon, 07 Mar 2016 09:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=5JuP+OBH18kkdU+vgEgcPa1Vz3v4SKMRxzuP3Wgj9LE=; b=fsjyt6S5dcad/+s/S0Yxw4MvCwWKm0Y5qPWOe7bNsK+EZ4QIFXUsLLqG35iv51+EhZ 0y8gOPQdNS3kC0z46thf4PtzrQXMUVRJOS5jgXOljywEgLKF92SZ7NpJCs/712XxgXK0 arT13VobeB7/tzEH3WW55DW76CLvB6aeGSdMiV+w1LtLbUDxrwiDZuvrcUdIKXRpqGEV MfBffWo10XPsDxedvshznI8CFGg1JCDf7Vs2A8YbjsHZgFfYCU8krNKEjAbdfisQVXK6 3cALblLMnCd1Src8KLrei4fhmslogDD32elZy+J+nVzEC8RAso2ugKaE5CN2eUmHTkf8 jTdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to; bh=5JuP+OBH18kkdU+vgEgcPa1Vz3v4SKMRxzuP3Wgj9LE=; b=j7Uwuq2dTzxG7i60dKE2VYw4gGVrwlhiurS0i1DoSUM3eWmru55eIiM4grI0+iKUeI rCnK0iCviyzd/ZomWylu6q6pmAyXCfX5SnHfZ23r1sXeAzC+euOdOmppL3xPDVXNivzz kIO0wbqRXFpYPXI1AyY6gfnp+KKJ4sKo4DW0qJzHRGTtVQfuO13Mz+KtweN/85wVgkTY 7Bz7tl/QuV2KEtxawGPlKa7BQLYa8tw3kq2tZmQ0RDyvivDLzYT3Rex23qpkLEjoW3Fv BkcRTQOL0sFrvzqNLpdsAKTDoTtI36BrcFmqeoU+fLzpmvw6c2cF2BUYKXC6/P11Pptw 487g== X-Gm-Message-State: AD7BkJK3WNPPwNJMqMT1taW5eER5JyBDKnYslUNzpiO50BjlIsC21emscPYArKft1V3ARQ== X-Received: by 10.202.78.138 with SMTP id c132mr8029844oib.103.1457373566868; Mon, 07 Mar 2016 09:59:26 -0800 (PST) Received: from ?IPv6:2602:306:37d8:1e20:a118:e186:74f3:4653? ([2602:306:37d8:1e20:a118:e186:74f3:4653]) by smtp.gmail.com with ESMTPSA id l124sm10376682oia.9.2016.03.07.09.59.24 for (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Mar 2016 09:59:25 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: pg_dump and pg_restore relative to the schema From: "Armand Pirvu (home)" In-Reply-To: <98DA8456-9D6D-47B0-BEC7-5D3C426C6F72@gmail.com> Date: Mon, 7 Mar 2016 11:59:23 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <66DA16B4-9B84-4392-990A-CF6F62105BCD@gmail.com> References: <98DA8456-9D6D-47B0-BEC7-5D3C426C6F72@gmail.com> To: pgsql-admin@postgresql.org X-Mailer: Apple Mail (2.1878.6) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Oops Forgot to include the pg_dump 1 - I took the table ddl /usr/pgsql-9.5/bin/pg_dump --username pgdba --format plain --file /var/lib= /pgsql/armandp/csireg.csilogs --schema-only -d csireg --table=3Dcsi_logs 2 - Dumped the data /usr/pgsql-9.5/bin/pg_dump --username pgdba --format custom --file /var/l= ib/pgsql/armandp/csireg.csilogs.data --data-only -d csireg --table=3Dcsi_l= ogs 3 - Replaced csilog with csidev in csireg.csilogs 4 - In the new db , which has the schema csidev, I created the table using = the DDL from (3) 5 - pg_restore fails -bash-4.2$ /usr/pgsql-9.5/bin/pg_restore --username=3Dpgdba --format=3Dc /v= ar/lib/pgsql/armandp/csireg.csilogs.data --data-only --dbname=3Dcsilog --t= able=3Dcsi_logs pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 3553; 0 29955 TABLE DATA c= si_logs pgdba pg_restore: [archiver (db)] could not execute query: ERROR: relation "csi_= logs" does not exist Command was: COPY csi_logs (log_id, log_time, log_server_name, severity_= level, log_message, json_data, stack_trace) FROM stdin; On Mar 7, 2016, at 11:55 AM, Armand Pirvu (home) w= rote: > Hi >=20 > I have a table in a db called csi_logs and it resides in it;s own schema = called csilog > I need to move it to a totally different database but with a different sc= hema called csidev >=20 > 1 - I took the table ddl > /usr/pgsql-9.5/bin/pg_dump --username pgdba --format plain --file /var/l= ib/pgsql/armandp/csireg.csilogs --schema-only -d csireg --table=3Dcsi_logs >=20 > 2 - Replaced csilog with csidev in csireg.csilogs >=20 > 3 - In the new db , which has the schema csidev, I created the table usin= g the DDL from (2) >=20 > 4 - pg_restore fails > -bash-4.2$ /usr/pgsql-9.5/bin/pg_restore --username=3Dpgdba --format=3Dc = /var/lib/pgsql/armandp/csireg.csilogs.data --data-only --dbname=3Dcsilog -= -table=3Dcsi_logs > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 3553; 0 29955 TABLE DATA= csi_logs pgdba > pg_restore: [archiver (db)] could not execute query: ERROR: relation "cs= i_logs" does not exist > Command was: COPY csi_logs (log_id, log_time, log_server_name, severit= y_level, log_message, json_data, stack_trace) FROM stdin; >=20 > Bu the table is there . So is the schema also embedded in the data file = ? I am going plain format now to see but if that would be the case, why emb= ed the schema in a data only file ?=20 > Any other gotchas ? >=20 > Thank you > Armand >=20 >=20 --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin