Re: pg_restore: custom archiver unexpected end of file , ERROR: missing data for column

Поиск
Список
Период
Сортировка
От Khangelani Gama
Тема Re: pg_restore: custom archiver unexpected end of file , ERROR: missing data for column
Дата
Msg-id 44cd8b917bbbe211547f27584f6499b2@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pg_restore: custom archiver unexpected end of file , ERROR: missing data for column  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
-----Original Message-----
From: Adrian Klaver [mailto:adrian.klaver@aklaver.com]
Sent: Thursday, June 19, 2014 3:34 PM
To: Khangelani Gama; Alban Hertroys
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] pg_restore: custom archiver unexpected end of file ,
ERROR: missing data for column

On 06/19/2014 05:03 AM, Khangelani Gama wrote:
> -----Original Message-----
> From: Alban Hertroys [mailto:haramrae@gmail.com]
> Sent: Thursday, June 19, 2014 1:54 PM
> To: Khangelani Gama
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] pg_restore: custom archiver unexpected end of
> file ,
> ERROR: missing data for column
>
> On 19 June 2014 13:11, Khangelani Gama <kgama@argility.com> wrote:
>>> Adrian you might be right I have just tried to pg_restore on the
>>> same server(8.4.2), I get the same errors related to xml. Can
>>> someone advise if the following XML file as an example is in the
>>> correct state or
>>> not:
>>
>>   Hi all
>>
>> I have a question, why is that pg_dump does not fail when dumping the
>> database but only fails when restoring the database?
>> Dumping the database from same server and restoring it on the same
>> server.
>> Since there is data issues inside the database why is the pg_dump not
>> failing as well?
>
> Because then you wouldn't be able to get your data out of your
> database once some corruption occurred. You would be forced to fix the
> issue on your live database.
>
> Now you can edit the dump and attempt to restore it until it succeeds
> on a different system, after which you know for certain that your data
> matches at least your integrity constraints.
>
> That makes sense to me, thanks ....Is there is an easier or better way
> to edit the binary dump file? Like how I can I fix a certain row or a
> column of pg_dump -Fc file? .... I am sorry I have never done this
> before....please give a clue on how I can do it.


You can think of the binary dump as a 'frozen' version of your database.
Generally you restore to another database, but it is also possible to
restore to a text file:

http://www.postgresql.org/docs/9.3/interactive/app-pgrestore.html

So if you use:

-f filename
--file=filename

     Specify output file for generated script, or for the listing when used
with -l. Default is the standard output.


instead of a database name you will create a text version of the
database dump. A word of caution, the text based version will be
considerably bigger than the binary compressed version. As I recall you
said the database in question is large so you might not want to convert
the whole thing. The same switches apply to restoring to a file that
work with restoring to a database. So it is possible to select one or
more tables and/or data and restore that only. The text file that is
generated can then be inspected. What cannot be done is after making
changes is reincorporating back into the binary dump. What you do after
making the changes depends on the relationships between the changed
tables and the other tables in the database. That would require more
information.

Another thought. Since pg_dump uses COPY(unless you specify INSERTs) you
might want to look at the COPY command and see if that is a better way
of seeing what is being retrieved from the table:

http://www.postgresql.org/docs/9.3/interactive/sql-copy.html

IMPORTANT:
"
COPY with a file name instructs the PostgreSQL server to directly read
from or write to a file. The file must be accessible to the server and
the name must be specified from the viewpoint of the server. When
PROGRAM is specified, the server executes the given command, and reads
from its standard input, or writes to its standard output. The command
must be specified from the viewpoint of the server, and be executable by
the postgres user. When STDIN or STDOUT is specified, data is
transmitted via the connection between the client and the server"


With COPY you can use a query so it is possible to restrict the data you
retrieve to a subset of the total.


Many Thanks, I think I will begin with pg_dump that uses INTERTS and see
what I get.




>
>
>
>
>



--
Adrian Klaver
adrian.klaver@aklaver.com


CONFIDENTIALITY NOTICE
The contents of and attachments to this e-mail are intended for the addressee only, and may contain the confidential
information of Argility (Proprietary) Limited and/or its subsidiaries. Any review, use or dissemination thereof by
anyone
other than the intended addressee is prohibited.If you are not the intended addressee please notify the writer
immediately
and destroy the e-mail. Argility (Proprietary) Limited and its subsidiaries distance themselves from and accept no
liability
for unauthorised use of their e-mail facilities or e-mails sent other than strictly for business purposes.



В списке pgsql-general по дате отправления:

Предыдущее
От: Andy Colson
Дата:
Сообщение: Re: How to store fixed size images?
Следующее
От: Alan Hodgson
Дата:
Сообщение: Re: How to store fixed size images?