Thread: merge 2 dumps

merge 2 dumps

From
Joao Ferreira gmail
Date:
hello all,

I have 2 dumps of the same Pg database in diferent instants.

I'dd like to merge the two dumps into one single dump in order to
restore all data at one time.

Is this possible ? are there any helper tools to aid in dealing with
text dump files ?

thanks

Joao



Re: merge 2 dumps

From
Richard Huxton
Date:
Joao Ferreira gmail wrote:
> hello all,
>
> I have 2 dumps of the same Pg database in diferent instants.
>
> I'dd like to merge the two dumps into one single dump in order to
> restore all data at one time.

Is there any overlap in the data?

If so, simplest might be to restore dump1, rename all the tables,
restore dump2 then run queries to rationalise your two sets of tables.

--
  Richard Huxton
  Archonet Ltd

Re: merge 2 dumps

From
Joao Ferreira gmail
Date:
On Tue, 2008-11-11 at 11:16 +0000, Richard Huxton wrote:
> Joao Ferreira gmail wrote:
> > hello all,
> >
> > I have 2 dumps of the same Pg database in diferent instants.
> >
> > I'dd like to merge the two dumps into one single dump in order to
> > restore all data at one time.
>
> Is there any overlap in the data?

no. I don't expect that there might be overlaps. any simpler solution in
this case ?

could I just get the "COPY TO" sections from the files and load them one
after the other ?

I never tried this before...

j


>
> If so, simplest might be to restore dump1, rename all the tables,
> restore dump2 then run queries to rationalise your two sets of tables.
>


Re: merge 2 dumps

From
Richard Huxton
Date:
Joao Ferreira gmail wrote:
> On Tue, 2008-11-11 at 11:16 +0000, Richard Huxton wrote:
>> Joao Ferreira gmail wrote:
>>> hello all,
>>>
>>> I have 2 dumps of the same Pg database in diferent instants.
>>>
>>> I'dd like to merge the two dumps into one single dump in order to
>>> restore all data at one time.
>> Is there any overlap in the data?
>
> no. I don't expect that there might be overlaps. any simpler solution in
> this case ?
>
> could I just get the "COPY TO" sections from the files and load them one
> after the other ?

Great - if it's something like log data for different years that makes
it much simpler. Just do a --data-only restore with the second dump,
that should work just fine.

--
  Richard Huxton
  Archonet Ltd

Timestamp precission question

From
Vaclav TVRDIK
Date:
Hello all,

I have one question about converting timestamps to text. I believed
that using to_char function with proper mask and casting by style
COLUMN::text is equal, but when I issue following query against  8.3.3
database it returns me different values (they differ on last position
of microsecconds value, maybe rounding error ?).
Could please somebody tell me what is the
reason ? I have tried to find some info about it on web but without
success.

Thanks in advance
Vaclav TVRDIK

WoC=> SELECT to_char(create_dat, 'YYYY-DD-MM HH24:MI:SS:US'),
create_dat::text
WoC-> from config
WoC-> where parameter_name = 'app_server_db_conn_pooler_connections';
          to_char           |         create_dat
----------------------------+----------------------------
 2008-02-09 12:12:15:214268 | 2008-09-02 12:12:15.214269
(1 row)


Re: Timestamp precission question

From
Tom Lane
Date:
Vaclav TVRDIK <tvrdik@i3.cz> writes:
> I have one question about converting timestamps to text. I believed
> that using to_char function with proper mask and casting by style
> COLUMN::text is equal, but when I issue following query against  8.3.3
> database it returns me different values (they differ on last position
> of microsecconds value, maybe rounding error ?).

Hm, I can't replicate that here --- but if you're using floating-point
timestamps, as is default in 8.3, then a certain amount of
machine-dependent roundoff fuzziness is not surprising.

            regards, tom lane

Re: Timestamp precission question

From
Vaclav TVRDIK
Date:
Tom Lane wrote:
> Hm, I can't replicate that here --- but if you're using floating-point
> timestamps, as is default in 8.3, then a certain amount of
> machine-dependent roundoff fuzziness is not surprising.
>
>             regards, tom lane
>
Column is defined in such way:
    CREATE_DAT        timestamp    not null default now(),

but  in my opinion the value is already stored in the column and then my
query should return same texts because they do display the same value in
the same format, shouldn't they ?

Thank you
Vaclav Tvrdik

Re: Timestamp precission question

From
Adriana Alfonzo
Date:
Por favor no quiero seguir recibiendo mensajes

Vaclav TVRDIK escribió:
> Tom Lane wrote:
>
>> Hm, I can't replicate that here --- but if you're using floating-point
>> timestamps, as is default in 8.3, then a certain amount of
>> machine-dependent roundoff fuzziness is not surprising.
>>
>>             regards, tom lane
>>
>>
> Column is defined in such way:
>     CREATE_DAT        timestamp    not null default now(),
>
> but  in my opinion the value is already stored in the column and then my
> query should return same texts because they do display the same value in
> the same format, shouldn't they ?
>
> Thank you
> Vaclav Tvrdik
>
>

Aviso Legal  Este mensaje puede contener informacion de interes solo para CVG Venalum. Solo esta permitida su copia,
distribuciono uso a personas autorizadas. Si recibio este corre por error, por favor destruyalo. Eventualmentew los
correoselectonicos pueden ser alterados. Al respecto, CVG Venalum no se hace responsable por los errores que pudieran
afectaral mensaje original. 

Attachment

Re: merge 2 dumps

From
Alan Hodgson
Date:
On Tuesday 11 November 2008, Joao Ferreira gmail
<joao.miguel.c.ferreira@gmail.com> wrote:
> could I just get the "COPY TO" sections from the files and load them one
> after the other ?
>
> I never tried this before...

You might have drop foreign keys before doing so and recreate them after -
the dumps aren't careful to maintain ordering.

--
Alan