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
c917660a
Commit
c917660a
authored
Sep 03, 2002
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround for format strings that are concatenated from macros
(INT64_FORMAT), which gettext cannot handle.
parent
738d1383
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
27 deletions
+85
-27
src/backend/commands/sequence.c
src/backend/commands/sequence.c
+48
-15
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.c
+37
-12
No files found.
src/backend/commands/sequence.c
View file @
c917660a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.8
5 2002/08/30 19:23:19 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.8
6 2002/09/03 18:50:54 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -400,8 +400,12 @@ nextval(PG_FUNCTION_ARGS)
...
@@ -400,8 +400,12 @@ nextval(PG_FUNCTION_ARGS)
if
(
rescnt
>
0
)
if
(
rescnt
>
0
)
break
;
/* stop fetching */
break
;
/* stop fetching */
if
(
!
seq
->
is_cycled
)
if
(
!
seq
->
is_cycled
)
elog
(
ERROR
,
"%s.nextval: reached MAXVALUE ("
INT64_FORMAT
")"
,
{
sequence
->
relname
,
maxv
);
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
maxv
);
elog
(
ERROR
,
"%s.nextval: reached MAXVALUE (%s)"
,
sequence
->
relname
,
buf
);
}
next
=
minv
;
next
=
minv
;
}
}
else
else
...
@@ -416,8 +420,12 @@ nextval(PG_FUNCTION_ARGS)
...
@@ -416,8 +420,12 @@ nextval(PG_FUNCTION_ARGS)
if
(
rescnt
>
0
)
if
(
rescnt
>
0
)
break
;
/* stop fetching */
break
;
/* stop fetching */
if
(
!
seq
->
is_cycled
)
if
(
!
seq
->
is_cycled
)
elog
(
ERROR
,
"%s.nextval: reached MINVALUE ("
INT64_FORMAT
")"
,
{
sequence
->
relname
,
minv
);
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
minv
);
elog
(
ERROR
,
"%s.nextval: reached MINVALUE (%s)"
,
sequence
->
relname
,
buf
);
}
next
=
maxv
;
next
=
maxv
;
}
}
else
else
...
@@ -551,8 +559,14 @@ do_setval(RangeVar *sequence, int64 next, bool iscalled)
...
@@ -551,8 +559,14 @@ do_setval(RangeVar *sequence, int64 next, bool iscalled)
seq
=
read_info
(
"setval"
,
elm
,
seqrel
,
&
buf
);
seq
=
read_info
(
"setval"
,
elm
,
seqrel
,
&
buf
);
if
((
next
<
seq
->
min_value
)
||
(
next
>
seq
->
max_value
))
if
((
next
<
seq
->
min_value
)
||
(
next
>
seq
->
max_value
))
elog
(
ERROR
,
"%s.setval: value "
INT64_FORMAT
" is out of bounds ("
INT64_FORMAT
","
INT64_FORMAT
")"
,
{
sequence
->
relname
,
next
,
seq
->
min_value
,
seq
->
max_value
);
char
bufv
[
100
],
bufm
[
100
],
bufx
[
100
];
snprintf
(
bufv
,
100
,
INT64_FORMAT
,
next
);
snprintf
(
bufm
,
100
,
INT64_FORMAT
,
seq
->
min_value
);
snprintf
(
bufx
,
100
,
INT64_FORMAT
,
seq
->
max_value
);
elog
(
ERROR
,
"%s.setval: value %s is out of bounds (%s,%s)"
,
sequence
->
relname
,
bufv
,
bufm
,
bufx
);
}
/* save info in local cache */
/* save info in local cache */
elm
->
last
=
next
;
/* last returned number */
elm
->
last
=
next
;
/* last returned number */
...
@@ -813,8 +827,13 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
...
@@ -813,8 +827,13 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
new
->
min_value
=
defGetInt64
(
min_value
);
new
->
min_value
=
defGetInt64
(
min_value
);
if
(
new
->
min_value
>=
new
->
max_value
)
if
(
new
->
min_value
>=
new
->
max_value
)
elog
(
ERROR
,
"DefineSequence: MINVALUE ("
INT64_FORMAT
") can't be >= MAXVALUE ("
INT64_FORMAT
")"
,
{
new
->
min_value
,
new
->
max_value
);
char
bufm
[
100
],
bufx
[
100
];
snprintf
(
bufm
,
100
,
INT64_FORMAT
,
new
->
min_value
);
snprintf
(
bufx
,
100
,
INT64_FORMAT
,
new
->
max_value
);
elog
(
ERROR
,
"DefineSequence: MINVALUE (%s) must be less than MAXVALUE (%s)"
,
bufm
,
bufx
);
}
if
(
last_value
==
(
DefElem
*
)
NULL
)
/* START WITH */
if
(
last_value
==
(
DefElem
*
)
NULL
)
/* START WITH */
{
{
...
@@ -827,17 +846,31 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
...
@@ -827,17 +846,31 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
new
->
last_value
=
defGetInt64
(
last_value
);
new
->
last_value
=
defGetInt64
(
last_value
);
if
(
new
->
last_value
<
new
->
min_value
)
if
(
new
->
last_value
<
new
->
min_value
)
elog
(
ERROR
,
"DefineSequence: START value ("
INT64_FORMAT
") can't be < MINVALUE ("
INT64_FORMAT
")"
,
{
new
->
last_value
,
new
->
min_value
);
char
bufs
[
100
],
bufm
[
100
];
snprintf
(
bufs
,
100
,
INT64_FORMAT
,
new
->
last_value
);
snprintf
(
bufm
,
100
,
INT64_FORMAT
,
new
->
min_value
);
elog
(
ERROR
,
"DefineSequence: START value (%s) can't be less than MINVALUE (%s)"
,
bufs
,
bufm
);
}
if
(
new
->
last_value
>
new
->
max_value
)
if
(
new
->
last_value
>
new
->
max_value
)
elog
(
ERROR
,
"DefineSequence: START value ("
INT64_FORMAT
") can't be > MAXVALUE ("
INT64_FORMAT
")"
,
{
new
->
last_value
,
new
->
max_value
);
char
bufs
[
100
],
bufm
[
100
];
snprintf
(
bufs
,
100
,
INT64_FORMAT
,
new
->
last_value
);
snprintf
(
bufm
,
100
,
INT64_FORMAT
,
new
->
max_value
);
elog
(
ERROR
,
"DefineSequence: START value (%s) can't be greater than MAXVALUE (%s)"
,
bufs
,
bufm
);
}
if
(
cache_value
==
(
DefElem
*
)
NULL
)
/* CACHE */
if
(
cache_value
==
(
DefElem
*
)
NULL
)
/* CACHE */
new
->
cache_value
=
1
;
new
->
cache_value
=
1
;
else
if
((
new
->
cache_value
=
defGetInt64
(
cache_value
))
<=
0
)
else
if
((
new
->
cache_value
=
defGetInt64
(
cache_value
))
<=
0
)
elog
(
ERROR
,
"DefineSequence: CACHE ("
INT64_FORMAT
") can't be <= 0"
,
{
new
->
cache_value
);
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
new
->
cache_value
);
elog
(
ERROR
,
"DefineSequence: CACHE (%s) can't be <= 0"
,
buf
);
}
}
}
...
...
src/bin/pg_dump/pg_backup_tar.c
View file @
c917660a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.2
6 2002/08/28 20:46:24 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.2
7 2002/09/03 18:50:54 petere
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1024,8 +1024,13 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
...
@@ -1024,8 +1024,13 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
die_horribly
(
AH
,
modulename
,
"could not close tar member: %s
\n
"
,
strerror
(
errno
));
die_horribly
(
AH
,
modulename
,
"could not close tar member: %s
\n
"
,
strerror
(
errno
));
if
(
len
!=
th
->
fileLen
)
if
(
len
!=
th
->
fileLen
)
die_horribly
(
AH
,
modulename
,
"actual file length ("
INT64_FORMAT
") does not match expected ("
INT64_FORMAT
")
\n
"
,
{
(
int64
)
len
,
(
int64
)
th
->
pos
);
char
buf1
[
100
],
buf2
[
100
];
snprintf
(
buf1
,
100
,
INT64_FORMAT
,
(
int64
)
len
);
snprintf
(
buf2
,
100
,
INT64_FORMAT
,
(
int64
)
th
->
pos
);
die_horribly
(
AH
,
modulename
,
"actual file length (%s) does not match expected (%s)
\n
"
,
buf1
,
buf2
);
}
pad
=
((
len
+
511
)
&
~
511
)
-
len
;
pad
=
((
len
+
511
)
&
~
511
)
-
len
;
for
(
i
=
0
;
i
<
pad
;
i
++
)
for
(
i
=
0
;
i
<
pad
;
i
++
)
...
@@ -1055,14 +1060,21 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
...
@@ -1055,14 +1060,21 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
/* Go to end of current file, if any */
/* Go to end of current file, if any */
if
(
ctx
->
tarFHpos
!=
0
)
if
(
ctx
->
tarFHpos
!=
0
)
{
{
ahlog
(
AH
,
4
,
"moving from position "
INT64_FORMAT
" to next member at file position "
INT64_FORMAT
"
\n
"
,
char
buf1
[
100
],
buf2
[
100
];
(
int64
)
ctx
->
tarFHpos
,
(
int64
)
ctx
->
tarNextMember
);
snprintf
(
buf1
,
100
,
INT64_FORMAT
,
(
int64
)
ctx
->
tarFHpos
);
snprintf
(
buf2
,
100
,
INT64_FORMAT
,
(
int64
)
ctx
->
tarNextMember
);
ahlog
(
AH
,
4
,
"moving from position %s to next member at file position %s
\n
"
,
buf1
,
buf2
);
while
(
ctx
->
tarFHpos
<
ctx
->
tarNextMember
)
while
(
ctx
->
tarFHpos
<
ctx
->
tarNextMember
)
_tarReadRaw
(
AH
,
&
c
,
1
,
NULL
,
ctx
->
tarFH
);
_tarReadRaw
(
AH
,
&
c
,
1
,
NULL
,
ctx
->
tarFH
);
}
}
ahlog
(
AH
,
4
,
"now at file position "
INT64_FORMAT
"
\n
"
,
(
int64
)
ctx
->
tarFHpos
);
{
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
(
int64
)
ctx
->
tarFHpos
);
ahlog
(
AH
,
4
,
"now at file position %s
\n
"
,
buf
);
}
/* We are at the start of the file. or at the next member */
/* We are at the start of the file. or at the next member */
...
@@ -1125,9 +1137,14 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
...
@@ -1125,9 +1137,14 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
{
{
#if 0
#if 0
if (ftello(ctx->tarFH) != ctx->tarFHpos)
if (ftello(ctx->tarFH) != ctx->tarFHpos)
{
char buf1[100], buf2[100];
snprintf(buf1, 100, INT64_FORMAT, (int64) ftello(ctx->tarFH));
snprintf(buf2, 100, INT64_FORMAT, (int64) ftello(ctx->tarFHpos));
die_horribly(AH, modulename,
die_horribly(AH, modulename,
"mismatch in actual vs. predicted file position (" INT64_FORMAT " vs. " INT64_FORMAT ")\n",
"mismatch in actual vs. predicted file position (%s vs. %s)\n",
(int64) ftello(ctx->tarFH), (int64) ctx->tarFHpos);
buf1, buf2);
}
#endif
#endif
/* Save the pos for reporting purposes */
/* Save the pos for reporting purposes */
...
@@ -1170,14 +1187,22 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
...
@@ -1170,14 +1187,22 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
sscanf
(
&
h
[
124
],
"%12o"
,
&
len
);
sscanf
(
&
h
[
124
],
"%12o"
,
&
len
);
sscanf
(
&
h
[
148
],
"%8o"
,
&
sum
);
sscanf
(
&
h
[
148
],
"%8o"
,
&
sum
);
ahlog
(
AH
,
3
,
"TOC Entry %s at "
INT64_FORMAT
" (length %lu, checksum %d)
\n
"
,
{
&
tag
[
0
],
(
int64
)
hPos
,
(
unsigned
long
)
len
,
sum
);
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
(
int64
)
hPos
);
ahlog
(
AH
,
3
,
"TOC Entry %s at %s (length %lu, checksum %d)
\n
"
,
&
tag
[
0
],
buf
,
(
unsigned
long
)
len
,
sum
);
}
if
(
chk
!=
sum
)
if
(
chk
!=
sum
)
{
char
buf
[
100
];
snprintf
(
buf
,
100
,
INT64_FORMAT
,
(
int64
)
ftello
(
ctx
->
tarFH
));
die_horribly
(
AH
,
modulename
,
die_horribly
(
AH
,
modulename
,
"corrupt tar header found in %s "
"corrupt tar header found in %s "
"(expected %d, computed %d) file position "
INT64_FORMAT
"
\n
"
,
"(expected %d, computed %d) file position %s
\n
"
,
&
tag
[
0
],
sum
,
chk
,
(
int64
)
ftello
(
ctx
->
tarFH
));
&
tag
[
0
],
sum
,
chk
,
buf
);
}
th
->
targetFile
=
strdup
(
tag
);
th
->
targetFile
=
strdup
(
tag
);
th
->
fileLen
=
len
;
th
->
fileLen
=
len
;
...
...
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