pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump and pg_restore relative to the schema
2+ messages / 1 participants
[nested] [flat]

* pg_dump and pg_restore relative to the schema
@ 2016-03-07 17:55  Armand Pirvu (home) <armand.pirvu@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Armand Pirvu (home) @ 2016-03-07 17:55 UTC (permalink / raw)
  To: pgsql-admin

Hi

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 schema called csidev

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=csi_logs

2 - Replaced csilog with csidev in csireg.csilogs

3 - In the new db , which has the schema csidev, I created the table using the DDL from (2)

4 - pg_restore fails
-bash-4.2$ /usr/pgsql-9.5/bin/pg_restore --username=pgdba --format=c /var/lib/pgsql/armandp/csireg.csilogs.data --data-only  --dbname=csilog --table=csi_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 "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;

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 embed the schema in a data only file ? 
Any other gotchas ?

Thank you
Armand




-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pg_dump and pg_restore relative to the schema
@ 2016-03-07 17:59  Armand Pirvu (home) <armand.pirvu@gmail.com>
  parent: Armand Pirvu (home) <armand.pirvu@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Armand Pirvu (home) @ 2016-03-07 17:59 UTC (permalink / raw)
  To: pgsql-admin

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=csi_logs

2 - Dumped the data

/usr/pgsql-9.5/bin/pg_dump --username pgdba --format custom  --file  /var/lib/pgsql/armandp/csireg.csilogs.data --data-only  -d csireg --table=csi_logs

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=pgdba --format=c /var/lib/pgsql/armandp/csireg.csilogs.data --data-only  --dbname=csilog --table=csi_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 "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) <armand.pirvu@gmail.com> wrote:

> Hi
> 
> 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 schema called csidev
> 
> 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=csi_logs
> 
> 2 - Replaced csilog with csidev in csireg.csilogs
> 
> 3 - In the new db , which has the schema csidev, I created the table using the DDL from (2)
> 
> 4 - pg_restore fails
> -bash-4.2$ /usr/pgsql-9.5/bin/pg_restore --username=pgdba --format=c /var/lib/pgsql/armandp/csireg.csilogs.data --data-only  --dbname=csilog --table=csi_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 "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;
> 
> 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 embed the schema in a data only file ? 
> Any other gotchas ?
> 
> Thank you
> Armand
> 
> 



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-03-07 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-03-07 17:55 pg_dump and pg_restore relative to the schema Armand Pirvu (home) <armand.pirvu@gmail.com>
2016-03-07 17:59 ` Armand Pirvu (home) <armand.pirvu@gmail.com>

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