Re: pg_restore - table restoration - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_restore - table restoration
Date
Msg-id 52D48663.5010704@gmail.com
Whole thread Raw
In response to pg_restore - table restoration  ("Day, David" <dday@redcom.com>)
Responses Re: pg_restore - table restoration
List pgsql-general
On 01/13/2014 01:43 PM, Day, David wrote:
> Hi,
>
> This is sort of a continuation of = problems I was working on last week
>
> with selective restorations of an archive file at the schema or table
> level.  ( V9.3)
>
> Given that I dumped the entire database ( pg_dump –Fc  my_db –f
> archive_file )
>
> When I pg_restore an entire schema ( -n ) everything is wonderful.
>
> If I try to attempt two tables in one of the schemas I encounter problems.
>
> I get a success of sort with these option  variations:
>
> pg_restore -c  -t tbl1 –t tbl2 –U <username> -d my_db  archive_file
>
> In this case the tables are recreated with data but all the original
>   constraints for these tables are missing
>
> As are triggers that are associated with the tables.   I guess I can
> understand this.

>
> Is this a bug or a mis-understanding on my part?


Oops, turns out I did not exactly replicate what you where doing and my
previous answer is wrong.

What I found.

When I do this:

/usr/local/pgsql93/bin/pg_dump -Fc  -U hplc_admin -p 5452 -f hplc.out hplc

and then this:

/usr/local/pgsql93/bin/pg_restore -c -t student_sessions -t
student_attendance -f hplc_table.sql hplc.out

I see what you see, no constraints or triggers in the SQL.

When I do what I originally posted about:

/usr/local/pgsql93/bin/pg_dump -Fc -c -t student_sessions -t
student_attendance -U hplc_admin -p 5452 -f hplc_tables_2.out hplc

and then this:

/usr/local/pgsql93/bin/pg_restore -c -f hplc_table_2.sql hplc_tables_2.out

I do see the constraints and triggers in the output.

I was under the impression that the result should be the same for both.
So I would consider this puzzling at the least and a bug at the most.
Someone else will have to chime in on what is really happening because I
do not know and I see nothing in the docs to suggest the behavior should
be different.


>
> Regards
>
> Dave Day
>


--
Adrian Klaver
adrian.klaver@gmail.com


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pg_restore - table restoration
Next
From: Adrian Klaver
Date:
Subject: Re: question about checksum in 9.3