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
7aee5ed3
Commit
7aee5ed3
authored
Jul 16, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tid to in/out as unsigned.
parent
14f15883
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
src/backend/utils/adt/numutils.c
src/backend/utils/adt/numutils.c
+3
-3
src/backend/utils/adt/tid.c
src/backend/utils/adt/tid.c
+18
-4
No files found.
src/backend/utils/adt/numutils.c
View file @
7aee5ed3
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.
49 2002/06/20 20:29:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.
50 2002/07/16 17:55:25
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,7 +46,7 @@ int32
pg_atoi
(
char
*
s
,
int
size
,
int
c
)
{
long
l
=
0
;
char
*
badp
=
(
char
*
)
NULL
;
char
*
badp
;
Assert
(
s
);
...
...
@@ -71,7 +71,7 @@ pg_atoi(char *s, int size, int c)
*/
if
(
errno
&&
errno
!=
EINVAL
)
elog
(
ERROR
,
"pg_atoi: error reading
\"
%s
\"
: %m"
,
s
);
if
(
badp
&&
*
badp
&&
(
*
badp
!=
c
)
)
if
(
*
badp
&&
*
badp
!=
c
)
elog
(
ERROR
,
"pg_atoi: error in
\"
%s
\"
: can
\'
t parse
\"
%s
\"
"
,
s
,
badp
);
switch
(
size
)
...
...
src/backend/utils/adt/tid.c
View file @
7aee5ed3
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.3
1 2002/06/20 20:29:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.3
2 2002/07/16 17:55:25
momjian Exp $
*
* NOTES
* input routine largely stolen from boxin().
...
...
@@ -18,6 +18,10 @@
#include "postgres.h"
#include <errno.h>
#include <math.h>
#include <limits.h>
#include "access/heapam.h"
#include "catalog/namespace.h"
#include "utils/builtins.h"
...
...
@@ -47,6 +51,8 @@ tidin(PG_FUNCTION_ARGS)
ItemPointer
result
;
BlockNumber
blockNumber
;
OffsetNumber
offsetNumber
;
char
*
badp
;
int
hold_offset
;
for
(
i
=
0
,
p
=
str
;
*
p
&&
i
<
NTIDARGS
&&
*
p
!=
RDELIM
;
p
++
)
if
(
*
p
==
DELIM
||
(
*
p
==
LDELIM
&&
!
i
))
...
...
@@ -55,8 +61,16 @@ tidin(PG_FUNCTION_ARGS)
if
(
i
<
NTIDARGS
)
elog
(
ERROR
,
"invalid tid format: '%s'"
,
str
);
blockNumber
=
(
BlockNumber
)
atoi
(
coord
[
0
]);
offsetNumber
=
(
OffsetNumber
)
atoi
(
coord
[
1
]);
errno
=
0
;
blockNumber
=
strtoul
(
coord
[
0
],
&
badp
,
10
);
if
(
errno
||
*
badp
!=
DELIM
)
elog
(
ERROR
,
"tidin: invalid value."
);
hold_offset
=
strtol
(
coord
[
1
],
&
badp
,
10
);
if
(
errno
||
*
badp
!=
RDELIM
||
hold_offset
>
USHRT_MAX
||
hold_offset
<
0
)
elog
(
ERROR
,
"tidin: invalid value."
);
offsetNumber
=
hold_offset
;
result
=
(
ItemPointer
)
palloc
(
sizeof
(
ItemPointerData
));
...
...
@@ -87,7 +101,7 @@ tidout(PG_FUNCTION_ARGS)
blockNumber
=
BlockIdGetBlockNumber
(
blockId
);
offsetNumber
=
itemPtr
->
ip_posid
;
sprintf
(
buf
,
"(%
d,%d)"
,
(
int
)
blockNumber
,
(
int
)
offsetNumber
);
sprintf
(
buf
,
"(%
u,%u)"
,
blockNumber
,
offsetNumber
);
PG_RETURN_CSTRING
(
pstrdup
(
buf
));
}
...
...
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