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
8dc42a3a
Commit
8dc42a3a
authored
Apr 25, 2001
by
Philip Warner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fixed CONSTRAINT TRIGGER dump to record tgconstrelid properly
- pgsql v7.0 compatbility
parent
38b0f2fb
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
370 additions
and
73 deletions
+370
-73
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup.h
+9
-2
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+20
-2
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_archiver.h
+2
-2
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_custom.c
+6
-2
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_db.c
+31
-7
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.c
+2
-1
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+298
-56
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dump.h
+2
-1
No files found.
src/bin/pg_dump/pg_backup.h
View file @
8dc42a3a
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.1
0 2001/04/01 05:42:50
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.1
1 2001/04/25 07:03:19
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -50,6 +50,9 @@
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
#define oidcmp(x,y) ( ((x) < (y) ? -1 : ((x) > (y)) ? 1 : 0) )
#define oideq(x,y) ( (x) == (y) )
#define oidle(x,y) ( (x) <= (y) )
#define oidge(x,y) ( (x) >= (y) )
#define oidzero(x) ( (x) == 0 )
typedef
enum
_archiveFormat
{
...
...
@@ -66,7 +69,10 @@ typedef enum _archiveFormat
*/
typedef
struct
_Archive
{
int
verbose
;
int
verbose
;
int
remoteVersion
;
int
minRemoteVersion
;
int
maxRemoteVersion
;
/* The rest is private */
}
Archive
;
...
...
@@ -115,6 +121,7 @@ typedef struct _restoreOptions
int
limitToList
;
int
compression
;
int
suppressDumpWarnings
;
/* Suppress output of WARNING entries to stderr */
}
RestoreOptions
;
/*
...
...
src/bin/pg_dump/pg_backup_archiver.c
View file @
8dc42a3a
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.2
4 2001/04/14 13:11:03
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.2
5 2001/04/25 07:03:19
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -169,6 +169,10 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
if
(
AH
->
version
<
K_VERS_1_3
)
die_horribly
(
AH
,
"Direct database connections are not supported in pre-1.3 archives"
);
/* XXX Should get this from the archive */
AHX
->
minRemoteVersion
=
070100
;
AHX
->
maxRemoteVersion
=
999999
;
ConnectDatabase
(
AHX
,
ropt
->
dbname
,
ropt
->
pghost
,
ropt
->
pgport
,
ropt
->
requirePassword
,
ropt
->
ignoreVersion
);
...
...
@@ -260,6 +264,18 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
/* Work out what, if anything, we want from this entry */
reqs
=
_tocEntryRequired
(
te
,
ropt
);
/* Dump any relevant dump warnings to stderr */
if
(
!
ropt
->
suppressDumpWarnings
&&
strcmp
(
te
->
desc
,
"WARNING"
)
==
0
)
{
if
(
!
ropt
->
dataOnly
&&
te
->
defn
!=
NULL
&&
strlen
(
te
->
defn
)
!=
0
)
{
fprintf
(
stderr
,
"%s: Warning from original dump file:
\n
%s
\n
"
,
progname
,
te
->
defn
);
}
else
if
(
te
->
copyStmt
!=
NULL
&&
strlen
(
te
->
copyStmt
)
!=
0
)
{
fprintf
(
stderr
,
"%s: Warning from original dump file:
\n
%s
\n
"
,
progname
,
te
->
copyStmt
);
}
}
if
((
reqs
&
1
)
!=
0
)
/* We want the schema */
{
/* Reconnect if necessary */
...
...
@@ -405,6 +421,7 @@ NewRestoreOptions(void)
opts
=
(
RestoreOptions
*
)
calloc
(
1
,
sizeof
(
RestoreOptions
));
opts
->
format
=
archUnknown
;
opts
->
suppressDumpWarnings
=
false
;
return
opts
;
}
...
...
@@ -1419,7 +1436,8 @@ _discoverArchiveFormat(ArchiveHandle *AH)
cnt
=
fread
(
sig
,
1
,
5
,
fh
);
if
(
cnt
!=
5
)
die_horribly
(
AH
,
"%s: input file is too short, or is unreadable
\n
"
,
progname
);
die_horribly
(
AH
,
"%s: input file is too short, or is unreadable (read %d, expected 5)
\n
"
,
progname
,
cnt
);
/* Save it, just in case we need it later */
strncpy
(
&
AH
->
lookahead
[
0
],
sig
,
5
);
...
...
src/bin/pg_dump/pg_backup_archiver.h
View file @
8dc42a3a
...
...
@@ -17,7 +17,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.3
1 2001/04/14 13:11:03
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.3
2 2001/04/25 07:03:19
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
* - Initial version.
...
...
@@ -68,7 +68,7 @@ typedef z_stream *z_streamp;
#define K_VERS_MAJOR 1
#define K_VERS_MINOR 5
#define K_VERS_REV
3
#define K_VERS_REV
5
/* Data block types */
#define BLK_DATA 1
...
...
src/bin/pg_dump/pg_backup_custom.c
View file @
8dc42a3a
...
...
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.1
0 2001/04/01 05:42:51
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.1
1 2001/04/25 07:03:19
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -786,6 +786,7 @@ _ReadBuf(ArchiveHandle *AH, void *buf, int len)
res
=
fread
(
buf
,
1
,
len
,
AH
->
FH
);
ctx
->
filePos
+=
res
;
return
res
;
}
...
...
@@ -854,7 +855,10 @@ _getFilePos(ArchiveHandle *AH, lclContext *ctx)
{
pos
=
ftell
(
AH
->
FH
);
if
(
pos
!=
ctx
->
filePos
)
fprintf
(
stderr
,
"Warning: ftell mismatch with filePos
\n
"
);
{
fprintf
(
stderr
,
"Warning: ftell mismatch with filePos - filePos used
\n
"
);
pos
=
ctx
->
filePos
;
}
}
else
pos
=
ctx
->
filePos
;
...
...
src/bin/pg_dump/pg_backup_db.c
View file @
8dc42a3a
...
...
@@ -5,7 +5,7 @@
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.1
7 2001/03/23 04:49:55 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.1
8 2001/04/25 07:03:19 pjw
Exp $
*
* NOTES
*
...
...
@@ -114,17 +114,36 @@ _prompt_for_password(char *username, char *password)
fprintf
(
stderr
,
"
\n\n
"
);
}
static
int
_parse_version
(
ArchiveHandle
*
AH
,
const
char
*
versionString
)
{
int
cnt
;
int
vmaj
,
vmin
,
vrev
;
cnt
=
sscanf
(
versionString
,
"%d.%d.%d"
,
&
vmaj
,
&
vmin
,
&
vrev
);
if
(
cnt
<
2
)
{
die_horribly
(
AH
,
"Unable to parse version string: %s
\n
"
,
versionString
);
}
if
(
cnt
==
2
)
vrev
=
0
;
return
(
100
*
vmaj
+
vmin
)
*
100
+
vrev
;
}
static
void
_check_database_version
(
ArchiveHandle
*
AH
,
bool
ignoreVersion
)
{
PGresult
*
res
;
double
myversion
;
int
myversion
;
const
char
*
remoteversion_str
;
double
remoteversion
;
int
remoteversion
;
PGconn
*
conn
=
AH
->
connection
;
myversion
=
strtod
(
PG_VERSION
,
NULL
);
myversion
=
_parse_version
(
AH
,
PG_VERSION
);
res
=
PQexec
(
conn
,
"SELECT version()"
);
if
(
!
res
||
PQresultStatus
(
res
)
!=
PGRES_TUPLES_OK
||
...
...
@@ -134,8 +153,14 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
"Explanation from backend: '%s'.
\n
"
,
PQerrorMessage
(
conn
));
remoteversion_str
=
PQgetvalue
(
res
,
0
,
0
);
remoteversion
=
strtod
(
remoteversion_str
+
11
,
NULL
);
if
(
myversion
!=
remoteversion
)
remoteversion
=
_parse_version
(
AH
,
remoteversion_str
+
11
);
PQclear
(
res
);
AH
->
public
.
remoteVersion
=
remoteversion
;
if
(
myversion
!=
remoteversion
&&
(
remoteversion
<
AH
->
public
.
minRemoteVersion
||
remoteversion
>
AH
->
public
.
maxRemoteVersion
)
)
{
fprintf
(
stderr
,
"Database version: %s
\n
%s version: %s
\n
"
,
remoteversion_str
,
progname
,
PG_VERSION
);
...
...
@@ -145,7 +170,6 @@ _check_database_version(ArchiveHandle *AH, bool ignoreVersion)
die_horribly
(
AH
,
"Aborting because of version mismatch.
\n
"
"Use --ignore-version if you think it's safe to proceed anyway.
\n
"
);
}
PQclear
(
res
);
}
/*
...
...
src/bin/pg_dump/pg_backup_tar.c
View file @
8dc42a3a
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.1
4 2001/04/14 13:11:03
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.1
5 2001/04/25 07:03:19
pjw Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
...
...
@@ -834,6 +834,7 @@ _CloseArchive(ArchiveHandle *AH)
ropt
->
dropSchema
=
1
;
ropt
->
compression
=
0
;
ropt
->
superuser
=
PQuser
(
AH
->
connection
);
ropt
->
suppressDumpWarnings
=
true
;
savVerbose
=
AH
->
public
.
verbose
;
AH
->
public
.
verbose
=
0
;
...
...
src/bin/pg_dump/pg_dump.c
View file @
8dc42a3a
This diff is collapsed.
Click to expand it.
src/bin/pg_dump/pg_dump.h
View file @
8dc42a3a
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_dump.h,v 1.6
2 2001/04/14 13:11:03
pjw Exp $
* $Id: pg_dump.h,v 1.6
3 2001/04/25 07:03:20
pjw Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
...
...
@@ -159,6 +159,7 @@ typedef struct _aggInfo
char
*
aggbasetype
;
char
*
agginitval
;
char
*
usename
;
int
convertok
;
/* Flag to indicate of version convertsion is OK */
}
AggInfo
;
typedef
struct
_oprInfo
...
...
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