Re: pg_restore - table restoration

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: "Day, David" <dday(at)redcom(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_restore - table restoration
Date: 2014-01-14 00:35:47
Message-ID: 52D48663.5010704@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-01-14 01:06:16 Re: question about checksum in 9.3
Previous Message Adrian Klaver 2014-01-13 22:10:51 Re: pg_restore - table restoration