Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
54a622ca
Commit
54a622ca
authored
Jan 03, 2012
by
Andrew Dunstan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggest use of psql when pg_restore gets a text dump.
parent
bc2a050d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+13
-2
No files found.
src/bin/pg_dump/pg_backup_archiver.c
View file @
54a622ca
...
...
@@ -77,6 +77,9 @@ typedef struct _parallel_slot
#define NO_SLOT (-1)
#define TEXT_DUMP_HEADER "--\n-- PostgreSQL database dump\n--\n\n"
#define TEXT_DUMPALL_HEADER "--\n-- PostgreSQL database cluster dump\n--\n\n"
/* state needed to save/restore an archive's output target */
typedef
struct
_outputContext
{
...
...
@@ -1862,12 +1865,20 @@ _discoverArchiveFormat(ArchiveHandle *AH)
else
{
/*
* *Maybe* we have a tar archive format file
... So, read first 512
* byte header...
* *Maybe* we have a tar archive format file
or a text dump ...
*
So, read first 512
byte header...
*/
cnt
=
fread
(
&
AH
->
lookahead
[
AH
->
lookaheadLen
],
1
,
512
-
AH
->
lookaheadLen
,
fh
);
AH
->
lookaheadLen
+=
cnt
;
if
(
AH
->
lookaheadLen
>=
strlen
(
TEXT_DUMPALL_HEADER
)
&&
(
strncmp
(
AH
->
lookahead
,
TEXT_DUMP_HEADER
,
strlen
(
TEXT_DUMP_HEADER
))
==
0
||
strncmp
(
AH
->
lookahead
,
TEXT_DUMPALL_HEADER
,
strlen
(
TEXT_DUMPALL_HEADER
))
==
0
))
{
/* looks like it's probably a text format dump. so suggest they try psql */
die_horribly
(
AH
,
modulename
,
"input file appears to be a text format dump. Please use psql.
\n
"
);
}
if
(
AH
->
lookaheadLen
!=
512
)
die_horribly
(
AH
,
modulename
,
"input file does not appear to be a valid archive (too short?)
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment