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
1b1dbb86
Commit
1b1dbb86
authored
Oct 13, 2000
by
Philip Warner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug in sequence dumping using new setval function
parent
8fb04f8f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
9 deletions
+26
-9
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+5
-1
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_archiver.h
+1
-1
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+19
-6
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/pg_restore.c
+1
-1
No files found.
src/bin/pg_dump/pg_backup_archiver.c
View file @
1b1dbb86
...
...
@@ -1483,12 +1483,16 @@ static int _tocEntryRequired(TocEntry* te, RestoreOptions *ropt)
}
}
/* Special Case: If 'SEQUENCE SET' and schemaOnly, then not needed */
if
(
ropt
->
schemaOnly
&&
(
strcmp
(
te
->
desc
,
"SEQUENCE SET"
)
==
0
)
)
return
0
;
/* Mask it if we only want schema */
if
(
ropt
->
schemaOnly
)
res
=
res
&
1
;
/* Mask it we only want data */
if
(
ropt
->
dataOnly
)
if
(
ropt
->
dataOnly
&&
(
strcmp
(
te
->
desc
,
"SEQUENCE SET"
)
!=
0
)
)
res
=
res
&
2
;
/* Mask it if we don't have a schema contribition */
...
...
src/bin/pg_dump/pg_backup_archiver.h
View file @
1b1dbb86
...
...
@@ -62,7 +62,7 @@ typedef z_stream *z_streamp;
#define K_VERS_MAJOR 1
#define K_VERS_MINOR 4
#define K_VERS_REV 1
6
#define K_VERS_REV 1
7
/* Data block types */
#define BLK_DATA 1
...
...
src/bin/pg_dump/pg_dump.c
View file @
1b1dbb86
...
...
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.1
69 2000/10/10 13:55:28
pjw Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.1
70 2000/10/13 00:43:31
pjw Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
...
...
@@ -992,6 +992,7 @@ main(int argc, char **argv)
MoveToEnd
(
g_fout
,
"INDEX"
);
MoveToEnd
(
g_fout
,
"TRIGGER"
);
MoveToEnd
(
g_fout
,
"RULE"
);
MoveToEnd
(
g_fout
,
"SEQUENCE SET"
);
if
(
plainText
)
{
...
...
@@ -4015,20 +4016,32 @@ dumpSequence(Archive *fout, TableInfo tbinfo)
resetPQExpBuffer
(
delqry
);
appendPQExpBuffer
(
delqry
,
"DROP SEQUENCE %s;
\n
"
,
fmtId
(
tbinfo
.
relname
,
force_quotes
));
/*
* The logic we use for restoring sequences is as follows:
* - Add a basic CREATE SEQUENCE statement
* (use last_val for start if called == 'f', else use min_val for start_val).
* - Add a 'SETVAL(seq, last_val, iscalled)' at restore-time iff we load data
*/
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
"CREATE SEQUENCE %s start %d increment %d maxvalue %d "
"minvalue %d cache %d %s;
\n
"
,
fmtId
(
tbinfo
.
relname
,
force_quotes
),
last
,
incby
,
maxv
,
minv
,
cache
,
fmtId
(
tbinfo
.
relname
,
force_quotes
),
(
called
==
't'
)
?
minv
:
last
,
incby
,
maxv
,
minv
,
cache
,
(
cycled
==
't'
)
?
"cycle"
:
""
);
if
(
called
!=
'f'
)
{
appendPQExpBuffer
(
query
,
"SELECT nextval ('%s');
\n
"
,
fmtId
(
tbinfo
.
relname
,
force_quotes
));
}
ArchiveEntry
(
fout
,
tbinfo
.
oid
,
fmtId
(
tbinfo
.
relname
,
force_quotes
),
"SEQUENCE"
,
NULL
,
query
->
data
,
delqry
->
data
,
""
,
tbinfo
.
usename
,
NULL
,
NULL
);
resetPQExpBuffer
(
query
);
appendPQExpBuffer
(
query
,
"SELECT setval ('%s', %d, '%c');
\n
"
,
fmtId
(
tbinfo
.
relname
,
force_quotes
),
last
,
called
);
ArchiveEntry
(
fout
,
tbinfo
.
oid
,
fmtId
(
tbinfo
.
relname
,
force_quotes
),
"SEQUENCE SET"
,
NULL
,
query
->
data
,
""
/* Del */
,
""
,
""
,
NULL
,
NULL
);
/* Dump Sequence Comments */
resetPQExpBuffer
(
query
);
...
...
src/bin/pg_dump/pg_restore.c
View file @
1b1dbb86
...
...
@@ -292,7 +292,7 @@ int main(int argc, char **argv)
MoveToEnd
(
AH
,
"INDEX"
);
MoveToEnd
(
AH
,
"TRIGGER"
);
MoveToEnd
(
AH
,
"RULE"
);
MoveToEnd
(
AH
,
"
ACL
"
);
MoveToEnd
(
AH
,
"
SEQUENCE SET
"
);
}
/* Database MUST be at start */
...
...
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