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
a68a132a
Commit
a68a132a
authored
Dec 06, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add VARHDRSZ where needed. Many places just used 4.
parent
1932d921
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
78 additions
and
78 deletions
+78
-78
src/backend/access/common/printtup.c
src/backend/access/common/printtup.c
+2
-2
src/backend/commands/async.c
src/backend/commands/async.c
+2
-2
src/backend/commands/trigger.c
src/backend/commands/trigger.c
+1
-1
src/backend/libpq/be-pqexec.c
src/backend/libpq/be-pqexec.c
+4
-4
src/backend/parser/gram.y
src/backend/parser/gram.y
+2
-2
src/backend/tcop/dest.c
src/backend/tcop/dest.c
+5
-5
src/backend/tcop/fastpath.c
src/backend/tcop/fastpath.c
+2
-2
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+16
-16
src/backend/utils/adt/chunk.c
src/backend/utils/adt/chunk.c
+6
-6
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varchar.c
+31
-31
src/backend/utils/adt/varlena.c
src/backend/utils/adt/varlena.c
+2
-2
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+2
-2
src/bin/psql/psql.c
src/bin/psql/psql.c
+3
-3
No files found.
src/backend/access/common/printtup.c
View file @
a68a132a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.1
8 1997/09/12 04:07:12
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.1
9 1997/12/06 22:56:20
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -124,7 +124,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
{
outputstr
=
fmgr
(
typoutput
,
attr
,
gettypelem
(
typeinfo
->
attrs
[
i
]
->
atttypid
));
pq_putint
(
strlen
(
outputstr
)
+
4
,
4
);
pq_putint
(
strlen
(
outputstr
)
+
VARHDRSZ
,
VARHDRSZ
);
pq_putnchar
(
outputstr
,
strlen
(
outputstr
));
pfree
(
outputstr
);
}
...
...
src/backend/commands/async.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.2
4 1997/11/20 23:20:56
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.2
5 1997/12/06 22:56:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -619,7 +619,7 @@ Async_NotifyFrontEnd()
if
(
whereToSendOutput
==
Remote
)
{
pq_putnchar
(
"A"
,
1
);
pq_putint
(
ourpid
,
4
);
pq_putint
(
ourpid
,
sizeof
(
ourpid
)
);
pq_putstr
(
DatumGetName
(
d
)
->
data
);
pq_flush
();
}
...
...
src/backend/commands/trigger.c
View file @
a68a132a
...
...
@@ -176,7 +176,7 @@ CreateTrigger(CreateTrigStmt * stmt)
{
char
*
ar
=
(
char
*
)
lfirst
(
le
);
len
+=
strlen
(
ar
)
+
4
;
len
+=
strlen
(
ar
)
+
VARHDRSZ
;
for
(;
*
ar
;
ar
++
)
{
if
(
*
ar
==
'\\'
)
...
...
src/backend/libpq/be-pqexec.c
View file @
a68a132a
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.
9 1997/11/10 05:15:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.
10 1997/12/06 22:56:35
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -80,7 +80,7 @@ PQfn(int fnid,
{
arg
[
i
]
=
(
char
*
)
args
[
i
].
u
.
ptr
;
}
else
if
(
args
[
i
].
len
>
4
)
else
if
(
args
[
i
].
len
>
sizeof
(
int4
)
)
{
elog
(
WARN
,
"arg_length of argument %d too long"
,
i
);
}
...
...
@@ -357,7 +357,7 @@ pqtest_PQfn(char *q)
v
=
atoi
(
fields
[
j
]);
if
(
v
!=
0
||
(
v
==
0
&&
fields
[
j
][
0
]
==
'0'
))
{
pqargs
[
k
].
len
=
4
;
pqargs
[
k
].
len
=
sizeof
(
int4
)
;
pqargs
[
k
].
u
.
integer
=
v
;
printf
(
"pqtest_PQfn: arg %d is int %d
\n
"
,
k
,
v
);
/* debug */
}
...
...
@@ -373,7 +373,7 @@ pqtest_PQfn(char *q)
* call PQfn
* ----------------
*/
pqres
=
PQfn
(
f
,
&
res
,
4
,
1
,
pqargs
,
i
-
1
);
pqres
=
PQfn
(
f
,
&
res
,
sizeof
(
int4
)
,
1
,
pqargs
,
i
-
1
);
printf
(
"pqtest_PQfn: pqres is %s
\n
"
,
pqres
);
/* debug */
/* ----------------
...
...
src/backend/parser/gram.y
View file @
a68a132a
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.7
7 1997/12/04 23:07:23 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.7
8 1997/12/06 22:56:42 momjian
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -2660,7 +2660,7 @@ Character: character '(' Iconst ')'
* between this and "text" is that we blank-pad and
* truncate where necessary
*/
$$->typlen =
4
+ $3;
$$->typlen =
VARHDRSZ
+ $3;
}
| character
{
...
...
src/backend/tcop/dest.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.1
4 1997/11/27 03:01:1
2 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.1
5 1997/12/06 22:57:0
2 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -192,9 +192,9 @@ NullCommand(CommandDest dest)
nPtr = (PQNotifyList *) SLGetSucc(&nPtr->Node))
{
pq_putnchar("A", 1);
pq_putint(0,
4
);
pq_putint(0,
sizeof(int4)
);
pq_putstr(nPtr->relname);
pq_putint(nPtr->be_pid,
4
);
pq_putint(nPtr->be_pid,
sizeof(nPtr->be_pid)
);
PQremoveNotify(nPtr);
}
pq_flush();
...
...
@@ -283,8 +283,8 @@ BeginCommand(char *pname,
{
pq_putstr
(
attrs
[
i
]
->
attname
.
data
);
/* if 16 char name
* oops.. */
pq_putint
((
int
)
attrs
[
i
]
->
atttypid
,
4
);
pq_putint
(
attrs
[
i
]
->
attlen
,
2
);
pq_putint
((
int
)
attrs
[
i
]
->
atttypid
,
sizeof
(
attrs
[
i
]
->
atttypid
)
);
pq_putint
(
attrs
[
i
]
->
attlen
,
sizeof
(
attrs
[
i
]
->
attlen
)
);
}
}
break
;
...
...
src/backend/tcop/fastpath.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.
7 1997/09/18 20:21:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.
8 1997/12/06 22:57:03
momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
...
...
@@ -101,7 +101,7 @@ SendFunctionResult(Oid fid, /* function id */
{
/* by-reference ... */
if
(
retlen
<
0
)
{
/* ... varlena */
pq_putint
(
VARSIZE
(
retval
)
-
VARHDRSZ
,
4
);
pq_putint
(
VARSIZE
(
retval
)
-
VARHDRSZ
,
VARHDRSZ
);
pq_putnchar
(
VARDATA
(
retval
),
VARSIZE
(
retval
)
-
VARHDRSZ
);
}
else
...
...
src/backend/utils/adt/arrayfuncs.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.2
0 1997/09/18 20:22
:10 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.2
1 1997/12/06 22:57
:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -649,7 +649,7 @@ array_out(ArrayType *v, Oid element_type)
/* get a wide string to print to */
p
=
array_dims
(
v
,
&
dummy_bool
);
nbytes
=
strlen
(
ARR_DATA_PTR
(
v
))
+
4
+
*
(
int
*
)
p
;
nbytes
=
strlen
(
ARR_DATA_PTR
(
v
))
+
VARHDRSZ
+
*
(
int
*
)
p
;
save_p
=
(
char
*
)
palloc
(
nbytes
);
...
...
@@ -787,18 +787,18 @@ array_dims(ArrayType *v, bool *isNull)
/*
* 33 since we assume 15 digits per number + ':' +'[]'
*/
save_p
=
p
=
(
char
*
)
palloc
(
nbytes
+
4
);
MemSet
(
save_p
,
0
,
nbytes
+
4
);
save_p
=
p
=
(
char
*
)
palloc
(
nbytes
+
VARHDRSZ
);
MemSet
(
save_p
,
0
,
nbytes
+
VARHDRSZ
);
dimv
=
ARR_DIMS
(
v
);
lb
=
ARR_LBOUND
(
v
);
p
+=
4
;
p
+=
VARHDRSZ
;
for
(
i
=
0
;
i
<
ARR_NDIM
(
v
);
i
++
)
{
sprintf
(
p
,
"[%d:%d]"
,
lb
[
i
],
dimv
[
i
]
+
lb
[
i
]
-
1
);
p
+=
strlen
(
p
);
}
nbytes
=
strlen
(
save_p
+
4
)
+
4
;
memmove
(
save_p
,
&
nbytes
,
4
);
nbytes
=
strlen
(
save_p
+
VARHDRSZ
)
+
VARHDRSZ
;
memmove
(
save_p
,
&
nbytes
,
VARHDRSZ
);
return
(
save_p
);
}
...
...
@@ -874,7 +874,7 @@ array_ref(ArrayType *array,
}
if
(
*
isNull
)
RETURN_NULL
;
if
(
VARSIZE
(
v
)
-
4
<
elmlen
)
if
(
VARSIZE
(
v
)
-
VARHDRSZ
<
elmlen
)
RETURN_NULL
;
lo_close
(
fd
);
retval
=
(
char
*
)
_ArrayCast
((
char
*
)
VARDATA
(
v
),
reftype
,
elmlen
);
...
...
@@ -1000,22 +1000,22 @@ array_clip(ArrayType *array,
{
char
*
buff
;
rsize
+=
4
;
rsize
+=
VARHDRSZ
;
buff
=
palloc
(
rsize
);
if
(
buff
)
isDestLO
=
false
;
if
(
ARR_IS_CHUNKED
(
array
))
{
_ReadChunkArray
(
lowerIndx
,
upperIndx
,
len
,
fd
,
&
(
buff
[
4
]),
_ReadChunkArray
(
lowerIndx
,
upperIndx
,
len
,
fd
,
&
(
buff
[
VARHDRSZ
]),
array
,
0
,
isNull
);
}
else
{
_ReadArray
(
lowerIndx
,
upperIndx
,
len
,
fd
,
(
int
)
&
(
buff
[
4
]),
_ReadArray
(
lowerIndx
,
upperIndx
,
len
,
fd
,
(
int
)
&
(
buff
[
VARHDRSZ
]),
array
,
0
,
isNull
);
}
memmove
(
buff
,
&
rsize
,
4
);
memmove
(
buff
,
&
rsize
,
VARHDRSZ
);
#ifdef LOARRAY
if
(
!*
isNull
)
bytes
=
LOwrite
(
newfd
,
(
struct
varlena
*
)
buff
);
...
...
@@ -1131,15 +1131,15 @@ array_set(ArrayType *array,
#endif
if
(
lo_lseek
(
fd
,
offset
,
SEEK_SET
)
<
0
)
return
((
char
*
)
array
);
v
=
(
struct
varlena
*
)
palloc
(
elmlen
+
4
);
VARSIZE
(
v
)
=
elmlen
+
4
;
v
=
(
struct
varlena
*
)
palloc
(
elmlen
+
VARHDRSZ
);
VARSIZE
(
v
)
=
elmlen
+
VARHDRSZ
;
ArrayCastAndSet
(
dataPtr
,
(
bool
)
reftype
,
elmlen
,
VARDATA
(
v
));
#ifdef LOARRAY
n
=
LOwrite
(
fd
,
v
);
#endif
/*
* if (n < VARSIZE(v) -
4
) RETURN_NULL;
* if (n < VARSIZE(v) -
VARHDRSZ
) RETURN_NULL;
*/
pfree
(
v
);
lo_close
(
fd
);
...
...
@@ -1692,7 +1692,7 @@ _LOtransfer(char **destfd,
{
#ifdef LOARRAY
v
=
(
struct
varlena
*
)
LOread
((
int
)
*
srcfd
,
inc
);
if
(
VARSIZE
(
v
)
-
4
<
inc
)
if
(
VARSIZE
(
v
)
-
VARHDRSZ
<
inc
)
{
pfree
(
v
);
return
(
-
1
);
...
...
src/backend/utils/adt/chunk.c
View file @
a68a132a
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.1
0 1997/09/08 21:48:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.1
1 1997/12/06 22:57:12
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -271,7 +271,7 @@ get_next(int d[], int k, int C, int dmax[])
}
#ifdef LOARRAY
static
char
a_chunk
[
BLCKSZ
+
4
];
/* 4
since a_chunk is in varlena format */
static
char
a_chunk
[
BLCKSZ
+
VARHDRSZ
];
/* VARHDRSZ
since a_chunk is in varlena format */
#endif
...
...
@@ -318,8 +318,8 @@ _ConvertToChunkFile(int n,
csize
*=
C
[
i
];
}
csize
*=
baseSize
;
temp
=
csize
+
4
;
memmove
(
a_chunk
,
&
temp
,
4
);
temp
=
csize
+
VARHDRSZ
;
memmove
(
a_chunk
,
&
temp
,
VARHDRSZ
);
mda_get_prod
(
n
,
dim
,
PX
);
mda_get_offset_values
(
n
,
dist
,
PX
,
C
);
...
...
@@ -327,7 +327,7 @@ _ConvertToChunkFile(int n,
;
do
{
read_chunk
(
chunk_no
,
C
,
&
(
a_chunk
[
4
]),
srcfd
,
n
,
baseSize
,
PX
,
dist
);
read_chunk
(
chunk_no
,
C
,
&
(
a_chunk
[
VARHDRSZ
]),
srcfd
,
n
,
baseSize
,
PX
,
dist
);
write_chunk
((
struct
varlena
*
)
a_chunk
,
destfd
);
}
while
(
next_tuple
(
n
,
chunk_no
,
max_chunks
)
!=
-
1
);
}
...
...
@@ -417,7 +417,7 @@ seek_and_read(int pos, int size, char buff[], int fp, int from)
#ifdef LOARRAY
v
=
(
struct
varlena
*
)
LOread
(
fp
,
size
);
#endif
if
(
VARSIZE
(
v
)
-
4
<
size
)
if
(
VARSIZE
(
v
)
-
VARHDRSZ
<
size
)
elog
(
WARN
,
"File read error"
);
memmove
(
buff
,
VARDATA
(
v
),
size
);
pfree
(
v
);
...
...
src/backend/utils/adt/varchar.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.1
1 1997/10/25 01:10:50
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.1
2 1997/12/06 22:57:14
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -46,7 +46,7 @@
/*
* bpcharin -
* converts a string of char() type to the internal representation.
* len is the length specified in () plus
4
bytes. (XXX dummy is here
* len is the length specified in () plus
VARHDRSZ
bytes. (XXX dummy is here
* because we pass typelem as the second argument for array_in.)
*/
char
*
...
...
@@ -54,7 +54,7 @@ bpcharin(char *s, int dummy, int typlen)
{
char
*
result
,
*
r
;
int
len
=
typlen
-
4
;
int
len
=
typlen
-
VARHDRSZ
;
int
i
;
if
(
s
==
NULL
)
...
...
@@ -67,7 +67,7 @@ bpcharin(char *s, int dummy, int typlen)
* this is here because some functions can't supply the typlen
*/
len
=
strlen
(
s
);
typlen
=
len
+
4
;
typlen
=
len
+
VARHDRSZ
;
}
if
(
len
>
4096
)
...
...
@@ -75,7 +75,7 @@ bpcharin(char *s, int dummy, int typlen)
result
=
(
char
*
)
palloc
(
typlen
);
*
(
int32
*
)
result
=
typlen
;
r
=
result
+
4
;
r
=
result
+
VARHDRSZ
;
for
(
i
=
0
;
i
<
len
;
i
++
,
r
++
,
s
++
)
{
*
r
=
*
s
;
...
...
@@ -104,9 +104,9 @@ bpcharout(char *s)
}
else
{
len
=
*
(
int32
*
)
s
-
4
;
len
=
*
(
int32
*
)
s
-
VARHDRSZ
;
result
=
(
char
*
)
palloc
(
len
+
1
);
StrNCpy
(
result
,
s
+
4
,
len
+
1
);
/* these are blank-padded */
StrNCpy
(
result
,
s
+
VARHDRSZ
,
len
+
1
);
/* these are blank-padded */
}
return
(
result
);
}
...
...
@@ -118,14 +118,14 @@ bpcharout(char *s)
/*
* vcharin -
* converts a string of varchar() type to the internal representation.
* len is the length specified in () plus
4
bytes. (XXX dummy is here
* len is the length specified in () plus
VARHDRSZ
bytes. (XXX dummy is here
* because we pass typelem as the second argument for array_in.)
*/
char
*
varcharin
(
char
*
s
,
int
dummy
,
int
typlen
)
{
char
*
result
;
int
len
=
typlen
-
4
;
int
len
=
typlen
-
VARHDRSZ
;
if
(
s
==
NULL
)
return
((
char
*
)
NULL
);
...
...
@@ -137,7 +137,7 @@ varcharin(char *s, int dummy, int typlen)
* this is here because some functions can't supply the typlen
*/
len
=
strlen
(
s
);
typlen
=
len
+
4
;
typlen
=
len
+
VARHDRSZ
;
}
if
(
len
>
4096
)
...
...
@@ -145,7 +145,7 @@ varcharin(char *s, int dummy, int typlen)
result
=
(
char
*
)
palloc
(
typlen
);
*
(
int32
*
)
result
=
typlen
;
strncpy
(
result
+
4
,
s
,
len
+
1
);
strncpy
(
result
+
VARHDRSZ
,
s
,
len
+
1
);
return
(
result
);
}
...
...
@@ -164,9 +164,9 @@ varcharout(char *s)
}
else
{
len
=
*
(
int32
*
)
s
-
4
;
len
=
*
(
int32
*
)
s
-
VARHDRSZ
;
result
=
(
char
*
)
palloc
(
len
+
1
);
StrNCpy
(
result
,
s
+
4
,
len
+
1
);
StrNCpy
(
result
,
s
+
VARHDRSZ
,
len
+
1
);
}
return
(
result
);
}
...
...
@@ -178,11 +178,11 @@ varcharout(char *s)
static
int
bcTruelen
(
char
*
arg
)
{
char
*
s
=
arg
+
4
;
char
*
s
=
arg
+
VARHDRSZ
;
int
i
;
int
len
;
len
=
*
(
int32
*
)
arg
-
4
;
len
=
*
(
int32
*
)
arg
-
VARHDRSZ
;
for
(
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
if
(
s
[
i
]
!=
' '
)
...
...
@@ -205,7 +205,7 @@ bpchareq(char *arg1, char *arg2)
if
(
len1
!=
len2
)
return
0
;
return
(
strncmp
(
arg1
+
4
,
arg2
+
4
,
len1
)
==
0
);
return
(
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
len1
)
==
0
);
}
bool
...
...
@@ -222,7 +222,7 @@ bpcharne(char *arg1, char *arg2)
if
(
len1
!=
len2
)
return
1
;
return
(
strncmp
(
arg1
+
4
,
arg2
+
4
,
len1
)
!=
0
);
return
(
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
len1
)
!=
0
);
}
bool
...
...
@@ -237,7 +237,7 @@ bpcharlt(char *arg1, char *arg2)
len1
=
bcTruelen
(
arg1
);
len2
=
bcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
cmp
==
0
)
return
(
len1
<
len2
);
else
...
...
@@ -256,7 +256,7 @@ bpcharle(char *arg1, char *arg2)
len1
=
bcTruelen
(
arg1
);
len2
=
bcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
0
==
cmp
)
return
(
bool
)
(
len1
<=
len2
?
1
:
0
);
else
...
...
@@ -275,7 +275,7 @@ bpchargt(char *arg1, char *arg2)
len1
=
bcTruelen
(
arg1
);
len2
=
bcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
cmp
==
0
)
return
(
len1
>
len2
);
else
...
...
@@ -294,7 +294,7 @@ bpcharge(char *arg1, char *arg2)
len1
=
bcTruelen
(
arg1
);
len2
=
bcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
0
==
cmp
)
return
(
bool
)
(
len1
>=
len2
?
1
:
0
);
else
...
...
@@ -311,7 +311,7 @@ bpcharcmp(char *arg1, char *arg2)
len1
=
bcTruelen
(
arg1
);
len2
=
bcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
((
0
==
cmp
)
&&
(
len1
!=
len2
))
return
(
int32
)
(
len1
<
len2
?
-
1
:
1
);
else
...
...
@@ -325,11 +325,11 @@ bpcharcmp(char *arg1, char *arg2)
static
int
vcTruelen
(
char
*
arg
)
{
char
*
s
=
arg
+
4
;
char
*
s
=
arg
+
VARHDRSZ
;
int
i
;
int
len
;
len
=
*
(
int32
*
)
arg
-
4
;
len
=
*
(
int32
*
)
arg
-
VARHDRSZ
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
*
s
++
==
'\0'
)
...
...
@@ -352,7 +352,7 @@ varchareq(char *arg1, char *arg2)
if
(
len1
!=
len2
)
return
0
;
return
(
strncmp
(
arg1
+
4
,
arg2
+
4
,
len1
)
==
0
);
return
(
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
len1
)
==
0
);
}
bool
...
...
@@ -369,7 +369,7 @@ varcharne(char *arg1, char *arg2)
if
(
len1
!=
len2
)
return
1
;
return
(
strncmp
(
arg1
+
4
,
arg2
+
4
,
len1
)
!=
0
);
return
(
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
len1
)
!=
0
);
}
bool
...
...
@@ -384,7 +384,7 @@ varcharlt(char *arg1, char *arg2)
len1
=
vcTruelen
(
arg1
);
len2
=
vcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
cmp
==
0
)
return
(
len1
<
len2
);
else
...
...
@@ -403,7 +403,7 @@ varcharle(char *arg1, char *arg2)
len1
=
vcTruelen
(
arg1
);
len2
=
vcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
0
==
cmp
)
return
(
bool
)
(
len1
<=
len2
?
1
:
0
);
else
...
...
@@ -422,7 +422,7 @@ varchargt(char *arg1, char *arg2)
len1
=
vcTruelen
(
arg1
);
len2
=
vcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
cmp
==
0
)
return
(
len1
>
len2
);
else
...
...
@@ -441,7 +441,7 @@ varcharge(char *arg1, char *arg2)
len1
=
vcTruelen
(
arg1
);
len2
=
vcTruelen
(
arg2
);
cmp
=
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
));
cmp
=
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
));
if
(
0
==
cmp
)
return
(
bool
)
(
len1
>=
len2
?
1
:
0
);
else
...
...
@@ -458,7 +458,7 @@ varcharcmp(char *arg1, char *arg2)
len1
=
vcTruelen
(
arg1
);
len2
=
vcTruelen
(
arg2
);
cmp
=
(
strncmp
(
arg1
+
4
,
arg2
+
4
,
Min
(
len1
,
len2
)));
cmp
=
(
strncmp
(
arg1
+
VARHDRSZ
,
arg2
+
VARHDRSZ
,
Min
(
len1
,
len2
)));
if
((
0
==
cmp
)
&&
(
len1
!=
len2
))
return
(
int32
)
(
len1
<
len2
?
-
1
:
1
);
else
...
...
src/backend/utils/adt/varlena.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.2
2 1997/11/23 21:39:12
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.2
3 1997/12/06 22:57:15
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -132,7 +132,7 @@ byteaout(struct varlena * vlena)
else
if
(
isascii
(
*
vp
)
&&
isprint
(
*
vp
))
len
++
;
else
len
+=
4
;
len
+=
VARHDRSZ
;
rp
=
result
=
(
char
*
)
palloc
(
len
);
vp
=
vlena
->
vl_dat
;
for
(
i
=
vlena
->
vl_len
-
sizeof
(
int32
);
i
!=
0
;
i
--
)
/* varlena? */
...
...
src/bin/pg_dump/pg_dump.c
View file @
a68a132a
...
...
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.5
7 1997/12/05 01:04:25 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.5
8 1997/12/06 22:57:28 momjian
Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
...
...
@@ -1671,7 +1671,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
tblinfo
[
i
].
typnames
[
j
]
=
strdup
(
PQgetvalue
(
res
,
j
,
i_typname
));
tblinfo
[
i
].
attlen
[
j
]
=
atoi
(
PQgetvalue
(
res
,
j
,
i_attlen
));
if
(
tblinfo
[
i
].
attlen
[
j
]
>
0
)
tblinfo
[
i
].
attlen
[
j
]
=
tblinfo
[
i
].
attlen
[
j
]
-
4
;
tblinfo
[
i
].
attlen
[
j
]
=
tblinfo
[
i
].
attlen
[
j
]
-
VARHDRSZ
;
tblinfo
[
i
].
inhAttrs
[
j
]
=
0
;
/* this flag is set in
* flagInhAttrs() */
tblinfo
[
i
].
notnull
[
j
]
=
(
PQgetvalue
(
res
,
j
,
i_attnotnull
)[
0
]
==
't'
)
?
true
:
false
;
...
...
src/bin/psql/psql.c
View file @
a68a132a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.1
19 1997/12/05 01:13:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.1
20 1997/12/06 22:57:36
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -616,12 +616,12 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
else
if
(
strcmp
(
rtype
,
"bpchar"
)
==
0
)
{
fprintf
(
fout
,
"%-32.32s |"
,
"(bp)char"
);
fprintf
(
fout
,
"%6i |"
,
rsize
>
0
?
rsize
-
4
:
0
);
fprintf
(
fout
,
"%6i |"
,
rsize
>
0
?
rsize
-
VARHDRSZ
:
0
);
}
else
if
(
strcmp
(
rtype
,
"varchar"
)
==
0
)
{
fprintf
(
fout
,
"%-32.32s |"
,
rtype
);
fprintf
(
fout
,
"%6i |"
,
rsize
>
0
?
rsize
-
4
:
0
);
fprintf
(
fout
,
"%6i |"
,
rsize
>
0
?
rsize
-
VARHDRSZ
:
0
);
}
else
{
...
...
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