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
6beba218
Commit
6beba218
authored
Nov 27, 1998
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New HeapTuple structure/interface.
parent
2435c7d5
Changes
65
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
65 changed files
with
835 additions
and
851 deletions
+835
-851
src/backend/Makefile
src/backend/Makefile
+4
-1
src/backend/access/common/heaptuple.c
src/backend/access/common/heaptuple.c
+96
-63
src/backend/access/common/heapvalid.c
src/backend/access/common/heapvalid.c
+3
-3
src/backend/access/common/printtup.c
src/backend/access/common/printtup.c
+7
-7
src/backend/access/common/tupdesc.c
src/backend/access/common/tupdesc.c
+2
-2
src/backend/access/gist/gist.c
src/backend/access/gist/gist.c
+1
-1
src/backend/access/hash/hash.c
src/backend/access/hash/hash.c
+2
-2
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+204
-206
src/backend/access/heap/hio.c
src/backend/access/heap/hio.c
+7
-7
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtinsert.c
+10
-11
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtree.c
+2
-2
src/backend/access/rtree/rtree.c
src/backend/access/rtree/rtree.c
+2
-2
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+4
-4
src/backend/catalog/aclchk.c
src/backend/catalog/aclchk.c
+2
-2
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+10
-10
src/backend/catalog/index.c
src/backend/catalog/index.c
+14
-14
src/backend/catalog/indexing.c
src/backend/catalog/indexing.c
+13
-11
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_aggregate.c
+7
-7
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_operator.c
+13
-13
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_proc.c
+4
-4
src/backend/catalog/pg_type.c
src/backend/catalog/pg_type.c
+8
-8
src/backend/commands/async.c
src/backend/commands/async.c
+6
-6
src/backend/commands/cluster.c
src/backend/commands/cluster.c
+12
-13
src/backend/commands/command.c
src/backend/commands/command.c
+5
-5
src/backend/commands/copy.c
src/backend/commands/copy.c
+9
-18
src/backend/commands/creatinh.c
src/backend/commands/creatinh.c
+5
-5
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+2
-2
src/backend/commands/defind.c
src/backend/commands/defind.c
+8
-8
src/backend/commands/proclang.c
src/backend/commands/proclang.c
+2
-2
src/backend/commands/remove.c
src/backend/commands/remove.c
+11
-11
src/backend/commands/rename.c
src/backend/commands/rename.c
+5
-5
src/backend/commands/sequence.c
src/backend/commands/sequence.c
+3
-3
src/backend/commands/trigger.c
src/backend/commands/trigger.c
+28
-26
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+75
-99
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+7
-31
src/backend/executor/execQual.c
src/backend/executor/execQual.c
+4
-7
src/backend/executor/execUtils.c
src/backend/executor/execUtils.c
+2
-2
src/backend/executor/functions.c
src/backend/executor/functions.c
+3
-5
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+2
-6
src/backend/executor/nodeGroup.c
src/backend/executor/nodeGroup.c
+11
-12
src/backend/executor/nodeHash.c
src/backend/executor/nodeHash.c
+21
-8
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeHashjoin.c
+9
-5
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeIndexscan.c
+6
-5
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMaterial.c
+16
-7
src/backend/executor/nodeTee.c
src/backend/executor/nodeTee.c
+11
-2
src/backend/executor/nodeUnique.c
src/backend/executor/nodeUnique.c
+3
-3
src/backend/executor/spi.c
src/backend/executor/spi.c
+8
-7
src/backend/libpq/be-dumpdata.c
src/backend/libpq/be-dumpdata.c
+4
-4
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/clauses.c
+2
-2
src/backend/parser/gram.c
src/backend/parser/gram.c
+1
-1
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+7
-10
src/backend/parser/parse_oper.c
src/backend/parser/parse_oper.c
+3
-3
src/backend/parser/parse_type.c
src/backend/parser/parse_type.c
+2
-2
src/backend/rewrite/rewriteRemove.c
src/backend/rewrite/rewriteRemove.c
+4
-4
src/backend/rewrite/rewriteSupport.c
src/backend/rewrite/rewriteSupport.c
+2
-2
src/backend/storage/large_object/inv_api.c
src/backend/storage/large_object/inv_api.c
+53
-51
src/backend/utils/adt/regproc.c
src/backend/utils/adt/regproc.c
+10
-8
src/backend/utils/adt/sets.c
src/backend/utils/adt/sets.c
+3
-3
src/backend/utils/cache/catcache.c
src/backend/utils/cache/catcache.c
+7
-7
src/backend/utils/cache/fcache.c
src/backend/utils/cache/fcache.c
+2
-2
src/backend/utils/cache/inval.c
src/backend/utils/cache/inval.c
+7
-7
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relcache.c
+20
-25
src/backend/utils/misc/database.c
src/backend/utils/misc/database.c
+6
-6
src/backend/utils/sort/psort.c
src/backend/utils/sort/psort.c
+10
-28
src/backend/utils/time/tqual.c
src/backend/utils/time/tqual.c
+3
-3
No files found.
src/backend/Makefile
View file @
6beba218
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#
#
#
#
# IDENTIFICATION
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.3
3 1998/04/27 04:04:05 momjian
Exp $
# $Header: /cvsroot/pgsql/src/backend/Makefile,v 1.3
4 1998/11/27 19:51:27 vadim
Exp $
#
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
...
@@ -86,6 +86,9 @@ catalog/global1.description catalog/local1_template1.description:
...
@@ -86,6 +86,9 @@ catalog/global1.description catalog/local1_template1.description:
postgres.o
:
$(OBJS)
postgres.o
:
$(OBJS)
$(CC)
-r
-o
postgres.o
$(OBJS)
$(LDFLAGS)
$(CC)
-r
-o
postgres.o
$(OBJS)
$(LDFLAGS)
fast
:
$(CC)
-r
-o
postgres.o
$(OBJS)
$(LDFLAGS)
############################################################################
############################################################################
# The following targets are specified in make commands that appear in the
# The following targets are specified in make commands that appear in the
...
...
src/backend/access/common/heaptuple.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.4
5 1998/10/08 18:29:10 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.4
6 1998/11/27 19:51:27 vadim
Exp $
*
*
* NOTES
* NOTES
* The old interface functions have been converted to macros
* The old interface functions have been converted to macros
...
@@ -36,12 +36,12 @@
...
@@ -36,12 +36,12 @@
/* Used by heap_getattr() macro, for speed */
/* Used by heap_getattr() macro, for speed */
long
heap_sysoffset
[]
=
{
long
heap_sysoffset
[]
=
{
/* Only the first one is pass-by-ref, and is handled specially in the macro */
/* Only the first one is pass-by-ref, and is handled specially in the macro */
offsetof
(
HeapTupleData
,
t_ctid
),
offsetof
(
HeapTuple
Header
Data
,
t_ctid
),
offsetof
(
HeapTupleData
,
t_oid
),
offsetof
(
HeapTuple
Header
Data
,
t_oid
),
offsetof
(
HeapTupleData
,
t_xmin
),
offsetof
(
HeapTuple
Header
Data
,
t_xmin
),
offsetof
(
HeapTupleData
,
t_cmin
),
offsetof
(
HeapTuple
Header
Data
,
t_cmin
),
offsetof
(
HeapTupleData
,
t_xmax
),
offsetof
(
HeapTuple
Header
Data
,
t_xmax
),
offsetof
(
HeapTupleData
,
t_cmax
)
offsetof
(
HeapTuple
Header
Data
,
t_cmax
)
};
};
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
...
@@ -167,14 +167,14 @@ DataFill(char *data,
...
@@ -167,14 +167,14 @@ DataFill(char *data,
int
int
heap_attisnull
(
HeapTuple
tup
,
int
attnum
)
heap_attisnull
(
HeapTuple
tup
,
int
attnum
)
{
{
if
(
attnum
>
(
int
)
tup
->
t_natts
)
if
(
attnum
>
(
int
)
tup
->
t_
data
->
t_
natts
)
return
1
;
return
1
;
if
(
HeapTupleNoNulls
(
tup
))
if
(
HeapTupleNoNulls
(
tup
))
return
0
;
return
0
;
if
(
attnum
>
0
)
if
(
attnum
>
0
)
return
att_isnull
(
attnum
-
1
,
tup
->
t_bits
);
return
att_isnull
(
attnum
-
1
,
tup
->
t_
data
->
t_
bits
);
else
else
switch
(
attnum
)
switch
(
attnum
)
{
{
...
@@ -210,7 +210,7 @@ heap_attisnull(HeapTuple tup, int attnum)
...
@@ -210,7 +210,7 @@ heap_attisnull(HeapTuple tup, int attnum)
int
int
heap_sysattrlen
(
AttrNumber
attno
)
heap_sysattrlen
(
AttrNumber
attno
)
{
{
HeapTuple
Data
*
f
=
NULL
;
HeapTuple
Header
f
=
NULL
;
switch
(
attno
)
switch
(
attno
)
{
{
...
@@ -323,12 +323,13 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
...
@@ -323,12 +323,13 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
* ----------------
* ----------------
*/
*/
Datum
Datum
nocachegetattr
(
HeapTuple
tup
,
nocachegetattr
(
HeapTuple
tup
le
,
int
attnum
,
int
attnum
,
TupleDesc
tupleDesc
,
TupleDesc
tupleDesc
,
bool
*
isnull
)
bool
*
isnull
)
{
{
char
*
tp
;
/* ptr to att in tuple */
char
*
tp
;
/* ptr to att in tuple */
HeapTupleHeader
tup
=
tuple
->
t_data
;
bits8
*
bp
=
tup
->
t_bits
;
/* ptr to att in tuple */
bits8
*
bp
=
tup
->
t_bits
;
/* ptr to att in tuple */
int
slow
;
/* do we have to walk nulls? */
int
slow
;
/* do we have to walk nulls? */
Form_pg_attribute
*
att
=
tupleDesc
->
attrs
;
Form_pg_attribute
*
att
=
tupleDesc
->
attrs
;
...
@@ -351,7 +352,7 @@ nocachegetattr(HeapTuple tup,
...
@@ -351,7 +352,7 @@ nocachegetattr(HeapTuple tup,
* ----------------
* ----------------
*/
*/
if
(
HeapTupleNoNulls
(
tup
))
if
(
HeapTupleNoNulls
(
tup
le
))
{
{
attnum
--
;
attnum
--
;
...
@@ -449,7 +450,7 @@ nocachegetattr(HeapTuple tup,
...
@@ -449,7 +450,7 @@ nocachegetattr(HeapTuple tup,
}
}
else
if
(
attnum
==
0
)
else
if
(
attnum
==
0
)
return
(
Datum
)
fetchatt
(
&
(
att
[
0
]),
(
char
*
)
tp
);
return
(
Datum
)
fetchatt
(
&
(
att
[
0
]),
(
char
*
)
tp
);
else
if
(
!
HeapTupleAllFixed
(
tup
))
else
if
(
!
HeapTupleAllFixed
(
tup
le
))
{
{
int
j
=
0
;
int
j
=
0
;
...
@@ -491,8 +492,8 @@ nocachegetattr(HeapTuple tup,
...
@@ -491,8 +492,8 @@ nocachegetattr(HeapTuple tup,
/* Can we compute more? We will probably need them */
/* Can we compute more? We will probably need them */
(
j
<
tup
->
t_natts
&&
(
j
<
tup
->
t_natts
&&
att
[
j
]
->
attcacheoff
==
-
1
&&
att
[
j
]
->
attcacheoff
==
-
1
&&
(
HeapTupleNoNulls
(
tup
)
||
!
att_isnull
(
j
,
bp
))
&&
(
HeapTupleNoNulls
(
tup
le
)
||
!
att_isnull
(
j
,
bp
))
&&
(
HeapTupleAllFixed
(
tup
)
||
(
HeapTupleAllFixed
(
tup
le
)
||
att
[
j
]
->
attlen
>
0
||
VARLENA_FIXED_SIZE
(
att
[
j
])));
j
++
)
att
[
j
]
->
attlen
>
0
||
VARLENA_FIXED_SIZE
(
att
[
j
])));
j
++
)
{
{
...
@@ -527,7 +528,7 @@ nocachegetattr(HeapTuple tup,
...
@@ -527,7 +528,7 @@ nocachegetattr(HeapTuple tup,
for
(
i
=
0
;
i
<
attnum
;
i
++
)
for
(
i
=
0
;
i
<
attnum
;
i
++
)
{
{
if
(
!
HeapTupleNoNulls
(
tup
))
if
(
!
HeapTupleNoNulls
(
tup
le
))
{
{
if
(
att_isnull
(
i
,
bp
))
if
(
att_isnull
(
i
,
bp
))
{
{
...
@@ -570,14 +571,41 @@ heap_copytuple(HeapTuple tuple)
...
@@ -570,14 +571,41 @@ heap_copytuple(HeapTuple tuple)
{
{
HeapTuple
newTuple
;
HeapTuple
newTuple
;
if
(
!
HeapTupleIsValid
(
tuple
))
if
(
!
HeapTupleIsValid
(
tuple
)
||
tuple
->
t_data
==
NULL
)
return
NULL
;
return
NULL
;
newTuple
=
(
HeapTuple
)
palloc
(
tuple
->
t_len
);
newTuple
=
(
HeapTuple
)
palloc
(
HEAPTUPLESIZE
+
tuple
->
t_len
);
memmove
((
char
*
)
newTuple
,
(
char
*
)
tuple
,
(
int
)
tuple
->
t_len
);
newTuple
->
t_len
=
tuple
->
t_len
;
newTuple
->
t_self
=
tuple
->
t_self
;
newTuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
newTuple
+
HEAPTUPLESIZE
);
memmove
((
char
*
)
newTuple
->
t_data
,
(
char
*
)
tuple
->
t_data
,
(
int
)
tuple
->
t_len
);
return
newTuple
;
return
newTuple
;
}
}
/* ----------------
* heap_copytuple_with_tuple
*
* returns a copy of an tuple->t_data
* ----------------
*/
void
heap_copytuple_with_tuple
(
HeapTuple
src
,
HeapTuple
dest
)
{
if
(
!
HeapTupleIsValid
(
src
)
||
src
->
t_data
==
NULL
)
{
dest
->
t_data
=
NULL
;
return
;
}
dest
->
t_len
=
src
->
t_len
;
dest
->
t_self
=
src
->
t_self
;
dest
->
t_data
=
(
HeapTupleHeader
)
palloc
(
src
->
t_len
);
memmove
((
char
*
)
dest
->
t_data
,
(
char
*
)
src
->
t_data
,
(
int
)
src
->
t_len
);
return
;
}
#ifdef NOT_USED
#ifdef NOT_USED
/* ----------------
/* ----------------
* heap_deformtuple
* heap_deformtuple
...
@@ -637,8 +665,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
...
@@ -637,8 +665,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
Datum
*
value
,
Datum
*
value
,
char
*
nulls
)
char
*
nulls
)
{
{
char
*
tp
;
/* tuple pointer */
HeapTuple
tuple
;
/* return tuple */
HeapTuple
tuple
;
/* return tuple */
HeapTupleHeader
td
;
/* tuple data */
int
bitmaplen
;
int
bitmaplen
;
long
len
;
long
len
;
int
hoff
;
int
hoff
;
...
@@ -646,7 +674,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
...
@@ -646,7 +674,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
int
i
;
int
i
;
int
numberOfAttributes
=
tupleDescriptor
->
natts
;
int
numberOfAttributes
=
tupleDescriptor
->
natts
;
len
=
offsetof
(
HeapTupleData
,
t_bits
);
len
=
offsetof
(
HeapTuple
Header
Data
,
t_bits
);
for
(
i
=
0
;
i
<
numberOfAttributes
&&
!
hasnull
;
i
++
)
for
(
i
=
0
;
i
<
numberOfAttributes
&&
!
hasnull
;
i
++
)
{
{
...
@@ -668,23 +696,24 @@ heap_formtuple(TupleDesc tupleDescriptor,
...
@@ -668,23 +696,24 @@ heap_formtuple(TupleDesc tupleDescriptor,
len
+=
ComputeDataSize
(
tupleDescriptor
,
value
,
nulls
);
len
+=
ComputeDataSize
(
tupleDescriptor
,
value
,
nulls
);
t
p
=
(
char
*
)
palloc
(
len
);
t
uple
=
(
HeapTuple
)
palloc
(
HEAPTUPLESIZE
+
len
);
t
uple
=
(
HeapTuple
)
tp
;
t
d
=
tuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
tuple
+
HEAPTUPLESIZE
);
;
MemSet
(
tp
,
0
,
(
int
)
len
);
MemSet
(
(
char
*
)
td
,
0
,
(
int
)
len
);
tuple
->
t_len
=
len
;
tuple
->
t_len
=
len
;
tuple
->
t_natts
=
numberOfAttributes
;
ItemPointerSetInvalid
(
&
(
tuple
->
t_self
));
tuple
->
t_hoff
=
hoff
;
td
->
t_natts
=
numberOfAttributes
;
td
->
t_hoff
=
hoff
;
DataFill
((
char
*
)
t
uple
+
tuple
->
t_hoff
,
DataFill
((
char
*
)
t
d
+
td
->
t_hoff
,
tupleDescriptor
,
tupleDescriptor
,
value
,
value
,
nulls
,
nulls
,
&
t
uple
->
t_infomask
,
&
t
d
->
t_infomask
,
(
hasnull
?
t
uple
->
t_bits
:
NULL
));
(
hasnull
?
t
d
->
t_bits
:
NULL
));
t
uple
->
t_infomask
|=
HEAP_XMAX_INVALID
;
t
d
->
t_infomask
|=
HEAP_XMAX_INVALID
;
return
tuple
;
return
tuple
;
}
}
...
@@ -767,13 +796,15 @@ heap_modifytuple(HeapTuple tuple,
...
@@ -767,13 +796,15 @@ heap_modifytuple(HeapTuple tuple,
* copy the header except for t_len, t_natts, t_hoff, t_bits, t_infomask
* copy the header except for t_len, t_natts, t_hoff, t_bits, t_infomask
* ----------------
* ----------------
*/
*/
infomask
=
newTuple
->
t_infomask
;
infomask
=
newTuple
->
t_data
->
t_infomask
;
memmove
((
char
*
)
&
newTuple
->
t_oid
,
/* XXX */
memmove
((
char
*
)
&
newTuple
->
t_data
->
t_oid
,
/* XXX */
(
char
*
)
&
tuple
->
t_oid
,
(
char
*
)
&
tuple
->
t_data
->
t_oid
,
((
char
*
)
&
tuple
->
t_hoff
-
(
char
*
)
&
tuple
->
t_oid
));
/* XXX */
((
char
*
)
&
tuple
->
t_data
->
t_hoff
-
newTuple
->
t_infomask
=
infomask
;
(
char
*
)
&
tuple
->
t_data
->
t_oid
));
/* XXX */
newTuple
->
t_natts
=
numberOfAttributes
;
/* fix t_natts just in
newTuple
->
t_data
->
t_infomask
=
infomask
;
* case */
newTuple
->
t_data
->
t_natts
=
numberOfAttributes
;
newTuple
->
t_self
=
tuple
->
t_self
;
return
newTuple
;
return
newTuple
;
}
}
...
@@ -787,28 +818,30 @@ heap_addheader(uint32 natts, /* max domain index */
...
@@ -787,28 +818,30 @@ heap_addheader(uint32 natts, /* max domain index */
int
structlen
,
/* its length */
int
structlen
,
/* its length */
char
*
structure
)
/* pointer to the struct */
char
*
structure
)
/* pointer to the struct */
{
{
char
*
tp
;
/* tuple data pointer */
HeapTuple
tuple
;
HeapTuple
tup
;
HeapTuple
Header
td
;
/* tuple data */
long
len
;
long
len
;
int
hoff
;
int
hoff
;
AssertArg
(
natts
>
0
);
AssertArg
(
natts
>
0
);
len
=
offsetof
(
HeapTupleData
,
t_bits
);
len
=
offsetof
(
HeapTuple
Header
Data
,
t_bits
);
hoff
=
len
=
DOUBLEALIGN
(
len
);
/* be conservative */
hoff
=
len
=
DOUBLEALIGN
(
len
);
/* be conservative */
len
+=
structlen
;
len
+=
structlen
;
tp
=
(
char
*
)
palloc
(
len
);
tuple
=
(
HeapTuple
)
palloc
(
HEAPTUPLESIZE
+
len
);
tup
=
(
HeapTuple
)
tp
;
td
=
tuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
tuple
+
HEAPTUPLESIZE
);
MemSet
((
char
*
)
tup
,
0
,
len
);
MemSet
((
char
*
)
td
,
0
,
(
int
)
len
);
tup
->
t_len
=
len
;
tuple
->
t_len
=
len
;
tp
+=
tup
->
t_hoff
=
hoff
;
ItemPointerSetInvalid
(
&
(
tuple
->
t_self
));
tup
->
t_natts
=
natts
;
td
->
t_hoff
=
hoff
;
tup
->
t_infomask
=
0
;
td
->
t_natts
=
natts
;
tup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
td
->
t_infomask
=
0
;
td
->
t_infomask
|=
HEAP_XMAX_INVALID
;
memmove
(
tp
,
structure
,
structlen
);
memmove
(
(
char
*
)
td
+
hoff
,
structure
,
structlen
);
return
tup
;
return
tup
le
;
}
}
src/backend/access/common/heapvalid.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.2
1 1997/09/22 03:58:32
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.2
2 1998/11/27 19:51:28
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -25,9 +25,9 @@
...
@@ -25,9 +25,9 @@
bool
bool
TupleUpdatedByCurXactAndCmd
(
HeapTuple
t
)
TupleUpdatedByCurXactAndCmd
(
HeapTuple
t
)
{
{
if
(
TransactionIdEquals
(
t
->
t_xmax
,
if
(
TransactionIdEquals
(
t
->
t_
data
->
t_
xmax
,
GetCurrentTransactionId
())
&&
GetCurrentTransactionId
())
&&
CommandIdGEScanCommandId
(
t
->
t_cmax
))
CommandIdGEScanCommandId
(
t
->
t_
data
->
t_
cmax
))
return
true
;
return
true
;
return
false
;
return
false
;
...
...
src/backend/access/common/printtup.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.3
5 1998/09/01 04:26:40 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.3
6 1998/11/27 19:51:28 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -100,7 +100,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -100,7 +100,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
*/
*/
j
=
0
;
j
=
0
;
k
=
1
<<
7
;
k
=
1
<<
7
;
for
(
i
=
0
;
i
<
tuple
->
t_natts
;)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;)
{
{
i
++
;
/* heap_getattr is a macro, so no
i
++
;
/* heap_getattr is a macro, so no
* increment */
* increment */
...
@@ -122,7 +122,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -122,7 +122,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
* send the attributes of this tuple
* send the attributes of this tuple
* ----------------
* ----------------
*/
*/
for
(
i
=
0
;
i
<
tuple
->
t_natts
;
++
i
)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;
++
i
)
{
{
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
@@ -204,7 +204,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -204,7 +204,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
bool
isnull
;
bool
isnull
;
Oid
typoutput
;
Oid
typoutput
;
for
(
i
=
0
;
i
<
tuple
->
t_natts
;
++
i
)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;
++
i
)
{
{
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
typoutput
=
typtoout
((
Oid
)
typeinfo
->
attrs
[
i
]
->
atttypid
);
typoutput
=
typtoout
((
Oid
)
typeinfo
->
attrs
[
i
]
->
atttypid
);
...
@@ -251,7 +251,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -251,7 +251,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
*/
*/
j
=
0
;
j
=
0
;
k
=
1
<<
7
;
k
=
1
<<
7
;
for
(
i
=
0
;
i
<
tuple
->
t_natts
;)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;)
{
{
i
++
;
/* heap_getattr is a macro, so no
i
++
;
/* heap_getattr is a macro, so no
* increment */
* increment */
...
@@ -274,9 +274,9 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -274,9 +274,9 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
* ----------------
* ----------------
*/
*/
#ifdef IPORTAL_DEBUG
#ifdef IPORTAL_DEBUG
fprintf
(
stderr
,
"sending tuple with %d atts
\n
"
,
tuple
->
t_natts
);
fprintf
(
stderr
,
"sending tuple with %d atts
\n
"
,
tuple
->
t_
data
->
t_
natts
);
#endif
#endif
for
(
i
=
0
;
i
<
tuple
->
t_natts
;
++
i
)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;
++
i
)
{
{
int32
len
=
typeinfo
->
attrs
[
i
]
->
attlen
;
int32
len
=
typeinfo
->
attrs
[
i
]
->
attlen
;
...
...
src/backend/access/common/tupdesc.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.4
4 1998/09/01 04:26:41 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.4
5 1998/11/27 19:51:28 vadim
Exp $
*
*
* NOTES
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
* some of the executor utility code such as "ExecTypeFromTL" should be
...
@@ -351,7 +351,7 @@ TupleDescInitEntry(TupleDesc desc,
...
@@ -351,7 +351,7 @@ TupleDescInitEntry(TupleDesc desc,
*/
*/
typeForm
=
(
Form_pg_type
)
GETSTRUCT
(
tuple
);
typeForm
=
(
Form_pg_type
)
GETSTRUCT
(
tuple
);
att
->
atttypid
=
tuple
->
t_oid
;
att
->
atttypid
=
tuple
->
t_
data
->
t_
oid
;
att
->
attalign
=
typeForm
->
typalign
;
att
->
attalign
=
typeForm
->
typalign
;
/* ------------------------
/* ------------------------
...
...
src/backend/access/gist/gist.c
View file @
6beba218
...
@@ -248,7 +248,7 @@ gistbuild(Relation heap,
...
@@ -248,7 +248,7 @@ gistbuild(Relation heap,
/* form an index tuple and point it at the heap tuple */
/* form an index tuple and point it at the heap tuple */
itup
=
index_formtuple
(
id
,
&
d
[
0
],
nulls
);
itup
=
index_formtuple
(
id
,
&
d
[
0
],
nulls
);
itup
->
t_tid
=
htup
->
t_
ctid
;
itup
->
t_tid
=
htup
->
t_
self
;
/*
/*
* Since we already have the index relation locked, we call
* Since we already have the index relation locked, we call
...
...
src/backend/access/hash/hash.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.2
2 1998/09/01 04:26:48 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.2
3 1998/11/27 19:51:31 vadim
Exp $
*
*
* NOTES
* NOTES
* This file contains only the public interface routines.
* This file contains only the public interface routines.
...
@@ -216,7 +216,7 @@ hashbuild(Relation heap,
...
@@ -216,7 +216,7 @@ hashbuild(Relation heap,
continue
;
continue
;
}
}
itup
->
t_tid
=
htup
->
t_
ctid
;
itup
->
t_tid
=
htup
->
t_
self
;
hitem
=
_hash_formitem
(
itup
);
hitem
=
_hash_formitem
(
itup
);
res
=
_hash_doinsert
(
index
,
hitem
);
res
=
_hash_doinsert
(
index
,
hitem
);
pfree
(
hitem
);
pfree
(
hitem
);
...
...
src/backend/access/heap/heapam.c
View file @
6beba218
This diff is collapsed.
Click to expand it.
src/backend/access/heap/hio.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Id: hio.c,v 1.1
3 1998/01/07 21:01:23 momjian
Exp $
* $Id: hio.c,v 1.1
4 1998/11/27 19:51:36 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -69,17 +69,17 @@ RelationPutHeapTuple(Relation relation,
...
@@ -69,17 +69,17 @@ RelationPutHeapTuple(Relation relation,
len
=
(
unsigned
)
DOUBLEALIGN
(
tuple
->
t_len
);
/* be conservative */
len
=
(
unsigned
)
DOUBLEALIGN
(
tuple
->
t_len
);
/* be conservative */
Assert
((
int
)
len
<=
PageGetFreeSpace
(
pageHeader
));
Assert
((
int
)
len
<=
PageGetFreeSpace
(
pageHeader
));
offnum
=
PageAddItem
((
Page
)
pageHeader
,
(
Item
)
tuple
,
offnum
=
PageAddItem
((
Page
)
pageHeader
,
(
Item
)
tuple
->
t_data
,
tuple
->
t_len
,
InvalidOffsetNumber
,
LP_USED
);
tuple
->
t_len
,
InvalidOffsetNumber
,
LP_USED
);
itemId
=
PageGetItemId
((
Page
)
pageHeader
,
offnum
);
itemId
=
PageGetItemId
((
Page
)
pageHeader
,
offnum
);
item
=
PageGetItem
((
Page
)
pageHeader
,
itemId
);
item
=
PageGetItem
((
Page
)
pageHeader
,
itemId
);
ItemPointerSet
(
&
((
HeapTuple
)
item
)
->
t_ctid
,
blockIndex
,
offnum
);
ItemPointerSet
(
&
((
HeapTuple
Header
)
item
)
->
t_ctid
,
blockIndex
,
offnum
);
WriteBuffer
(
buffer
);
WriteBuffer
(
buffer
);
/* return an accurate tuple */
/* return an accurate tuple */
ItemPointerSet
(
&
tuple
->
t_
ctid
,
blockIndex
,
offnum
);
ItemPointerSet
(
&
tuple
->
t_
self
,
blockIndex
,
offnum
);
}
}
/*
/*
...
@@ -160,7 +160,7 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
...
@@ -160,7 +160,7 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
elog
(
ERROR
,
"Tuple is too big: size %d"
,
len
);
elog
(
ERROR
,
"Tuple is too big: size %d"
,
len
);
}
}
offnum
=
PageAddItem
((
Page
)
pageHeader
,
(
Item
)
tuple
,
offnum
=
PageAddItem
((
Page
)
pageHeader
,
(
Item
)
tuple
->
t_data
,
tuple
->
t_len
,
InvalidOffsetNumber
,
LP_USED
);
tuple
->
t_len
,
InvalidOffsetNumber
,
LP_USED
);
itemId
=
PageGetItemId
((
Page
)
pageHeader
,
offnum
);
itemId
=
PageGetItemId
((
Page
)
pageHeader
,
offnum
);
...
@@ -168,10 +168,10 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
...
@@ -168,10 +168,10 @@ RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
lastblock
=
BufferGetBlockNumber
(
buffer
);
lastblock
=
BufferGetBlockNumber
(
buffer
);
ItemPointerSet
(
&
((
HeapTuple
)
item
)
->
t_ctid
,
lastblock
,
offnum
);
ItemPointerSet
(
&
((
HeapTuple
Header
)
item
)
->
t_ctid
,
lastblock
,
offnum
);
/* return an accurate tuple */
/* return an accurate tuple */
ItemPointerSet
(
&
tuple
->
t_
ctid
,
lastblock
,
offnum
);
ItemPointerSet
(
&
tuple
->
t_
self
,
lastblock
,
offnum
);
WriteBuffer
(
buffer
);
WriteBuffer
(
buffer
);
}
}
src/backend/access/nbtree/nbtinsert.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.3
0 1998/09/01 04:27:01 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.3
1 1998/11/27 19:51:40 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -98,8 +98,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
...
@@ -98,8 +98,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
{
{
TupleDesc
itupdesc
;
TupleDesc
itupdesc
;
BTItem
btitem
;
BTItem
btitem
;
IndexTuple
itup
;
HeapTupleData
htup
;
HeapTuple
htup
;
BTPageOpaque
opaque
;
BTPageOpaque
opaque
;
Buffer
nbuf
;
Buffer
nbuf
;
BlockNumber
blkno
;
BlockNumber
blkno
;
...
@@ -120,9 +119,9 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
...
@@ -120,9 +119,9 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
while
(
_bt_isequal
(
itupdesc
,
page
,
offset
,
natts
,
itup_scankey
))
while
(
_bt_isequal
(
itupdesc
,
page
,
offset
,
natts
,
itup_scankey
))
{
/* they're equal */
{
/* they're equal */
btitem
=
(
BTItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offset
));
btitem
=
(
BTItem
)
PageGetItem
(
page
,
PageGetItemId
(
page
,
offset
));
itup
=
&
(
btitem
->
bti_itup
)
;
htup
.
t_self
=
btitem
->
bti_itup
.
t_tid
;
h
tup
=
heap_fetch
(
heapRel
,
SnapshotSelf
,
&
(
itup
->
t_tid
)
,
&
buffer
);
h
eap_fetch
(
heapRel
,
SnapshotSelf
,
&
htup
,
&
buffer
);
if
(
htup
!=
(
HeapTuple
)
NULL
)
if
(
htup
.
t_data
!=
NULL
)
{
/* it is a duplicate */
{
/* it is a duplicate */
elog
(
ERROR
,
"Cannot insert a duplicate key into a unique index"
);
elog
(
ERROR
,
"Cannot insert a duplicate key into a unique index"
);
}
}
...
...
src/backend/access/nbtree/nbtree.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.3
3 1998/09/07 05:35:33 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.3
4 1998/11/27 19:51:40 vadim
Exp $
*
*
* NOTES
* NOTES
* This file contains only the public interface routines.
* This file contains only the public interface routines.
...
@@ -256,7 +256,7 @@ btbuild(Relation heap,
...
@@ -256,7 +256,7 @@ btbuild(Relation heap,
* if (itup->t_info & INDEX_NULL_MASK) { pfree(itup); continue; }
* if (itup->t_info & INDEX_NULL_MASK) { pfree(itup); continue; }
*/
*/
itup
->
t_tid
=
htup
->
t_
ctid
;
itup
->
t_tid
=
htup
->
t_
self
;
btitem
=
_bt_formitem
(
itup
);
btitem
=
_bt_formitem
(
itup
);
/*
/*
...
...
src/backend/access/rtree/rtree.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.2
8 1998/09/01 04:27:10 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.2
9 1998/11/27 19:51:41 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -233,7 +233,7 @@ rtbuild(Relation heap,
...
@@ -233,7 +233,7 @@ rtbuild(Relation heap,
/* form an index tuple and point it at the heap tuple */
/* form an index tuple and point it at the heap tuple */
itup
=
index_formtuple
(
id
,
&
d
[
0
],
nulls
);
itup
=
index_formtuple
(
id
,
&
d
[
0
],
nulls
);
itup
->
t_tid
=
htup
->
t_
ctid
;
itup
->
t_tid
=
htup
->
t_
self
;
/*
/*
* Since we already have the index relation locked, we call
* Since we already have the index relation locked, we call
...
...
src/backend/bootstrap/bootstrap.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.5
1 1998/09/01 04:27:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.5
2 1998/11/27 19:51:45 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -473,7 +473,7 @@ boot_openrel(char *relname)
...
@@ -473,7 +473,7 @@ boot_openrel(char *relname)
app
=
Typ
;
app
=
Typ
;
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
{
{
(
*
app
)
->
am_oid
=
tup
->
t_oid
;
(
*
app
)
->
am_oid
=
tup
->
t_
data
->
t_
oid
;
memmove
((
char
*
)
&
(
*
app
++
)
->
am_typ
,
memmove
((
char
*
)
&
(
*
app
++
)
->
am_typ
,
(
char
*
)
GETSTRUCT
(
tup
),
(
char
*
)
GETSTRUCT
(
tup
),
sizeof
((
*
app
)
->
am_typ
));
sizeof
((
*
app
)
->
am_typ
));
...
@@ -634,7 +634,7 @@ InsertOneTuple(Oid objectid)
...
@@ -634,7 +634,7 @@ InsertOneTuple(Oid objectid)
pfree
(
tupDesc
);
/* just free's tupDesc, not the attrtypes */
pfree
(
tupDesc
);
/* just free's tupDesc, not the attrtypes */
if
(
objectid
!=
(
Oid
)
0
)
if
(
objectid
!=
(
Oid
)
0
)
tuple
->
t_oid
=
objectid
;
tuple
->
t_
data
->
t_
oid
=
objectid
;
heap_insert
(
reldesc
,
tuple
);
heap_insert
(
reldesc
,
tuple
);
pfree
(
tuple
);
pfree
(
tuple
);
if
(
DebugMode
)
if
(
DebugMode
)
...
@@ -830,7 +830,7 @@ gettype(char *type)
...
@@ -830,7 +830,7 @@ gettype(char *type)
app
=
Typ
;
app
=
Typ
;
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
{
{
(
*
app
)
->
am_oid
=
tup
->
t_oid
;
(
*
app
)
->
am_oid
=
tup
->
t_
data
->
t_
oid
;
memmove
((
char
*
)
&
(
*
app
++
)
->
am_typ
,
memmove
((
char
*
)
&
(
*
app
++
)
->
am_typ
,
(
char
*
)
GETSTRUCT
(
tup
),
(
char
*
)
GETSTRUCT
(
tup
),
sizeof
((
*
app
)
->
am_typ
));
sizeof
((
*
app
)
->
am_typ
));
...
...
src/backend/catalog/aclchk.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.1
6 1998/09/01 04:27:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.1
7 1998/11/27 19:51:46 vadim
Exp $
*
*
* NOTES
* NOTES
* See acl.h.
* See acl.h.
...
@@ -162,7 +162,7 @@ ChangeAcl(char *relname,
...
@@ -162,7 +162,7 @@ ChangeAcl(char *relname,
tuple
=
heap_modifytuple
(
tuple
,
relation
,
values
,
nulls
,
replaces
);
tuple
=
heap_modifytuple
(
tuple
,
relation
,
values
,
nulls
,
replaces
);
/* XXX handle index on pg_class? */
/* XXX handle index on pg_class? */
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
relation
,
&
tuple
->
t_
ctid
,
tuple
);
heap_replace
(
relation
,
&
tuple
->
t_
self
,
tuple
);
setheapoverride
(
false
);
setheapoverride
(
false
);
/* keep the catalog indices up to date */
/* keep the catalog indices up to date */
...
...
src/backend/catalog/heap.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.6
6 1998/11/17 14:26:39 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.6
7 1998/11/27 19:51:48 vadim
Exp $
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation
* heap_create() - Create an uncataloged heap relation
...
@@ -663,7 +663,7 @@ AddPgRelationTuple(Relation pg_class_desc,
...
@@ -663,7 +663,7 @@ AddPgRelationTuple(Relation pg_class_desc,
tup
=
heap_addheader
(
Natts_pg_class_fixed
,
tup
=
heap_addheader
(
Natts_pg_class_fixed
,
CLASS_TUPLE_SIZE
,
CLASS_TUPLE_SIZE
,
(
char
*
)
new_rel_reltup
);
(
char
*
)
new_rel_reltup
);
tup
->
t_oid
=
new_rel_oid
;
tup
->
t_
data
->
t_
oid
=
new_rel_oid
;
/* ----------------
/* ----------------
* finally insert the new tuple and free it.
* finally insert the new tuple and free it.
...
@@ -929,7 +929,7 @@ RelationRemoveInheritance(Relation relation)
...
@@ -929,7 +929,7 @@ RelationRemoveInheritance(Relation relation)
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
)))
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
)))
{
{
heap_delete
(
catalogRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
catalogRelation
,
&
tuple
->
t_
self
);
found
=
true
;
found
=
true
;
}
}
...
@@ -951,7 +951,7 @@ RelationRemoveInheritance(Relation relation)
...
@@ -951,7 +951,7 @@ RelationRemoveInheritance(Relation relation)
&
entry
);
&
entry
);
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
)))
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scan
,
0
)))
heap_delete
(
catalogRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
catalogRelation
,
&
tuple
->
t_
self
);
heap_endscan
(
scan
);
heap_endscan
(
scan
);
heap_close
(
catalogRelation
);
heap_close
(
catalogRelation
);
...
@@ -1020,7 +1020,7 @@ DeletePgRelationTuple(Relation rel)
...
@@ -1020,7 +1020,7 @@ DeletePgRelationTuple(Relation rel)
* delete the relation tuple from pg_class, and finish up.
* delete the relation tuple from pg_class, and finish up.
* ----------------
* ----------------
*/
*/
heap_delete
(
pg_class_desc
,
&
tup
->
t_
ctid
);
heap_delete
(
pg_class_desc
,
&
tup
->
t_
self
);
pfree
(
tup
);
pfree
(
tup
);
heap_close
(
pg_class_desc
);
heap_close
(
pg_class_desc
);
...
@@ -1059,7 +1059,7 @@ DeletePgAttributeTuples(Relation rel)
...
@@ -1059,7 +1059,7 @@ DeletePgAttributeTuples(Relation rel)
Int16GetDatum
(
attnum
),
Int16GetDatum
(
attnum
),
0
,
0
)))
0
,
0
)))
{
{
heap_delete
(
pg_attribute_desc
,
&
tup
->
t_
ctid
);
heap_delete
(
pg_attribute_desc
,
&
tup
->
t_
self
);
pfree
(
tup
);
pfree
(
tup
);
}
}
}
}
...
@@ -1138,7 +1138,7 @@ DeletePgTypeTuple(Relation rel)
...
@@ -1138,7 +1138,7 @@ DeletePgTypeTuple(Relation rel)
* stonebraker about this. -cim 6/19/90
* stonebraker about this. -cim 6/19/90
* ----------------
* ----------------
*/
*/
typoid
=
tup
->
t_oid
;
typoid
=
tup
->
t_
data
->
t_
oid
;
pg_attribute_desc
=
heap_openr
(
AttributeRelationName
);
pg_attribute_desc
=
heap_openr
(
AttributeRelationName
);
...
@@ -1183,7 +1183,7 @@ DeletePgTypeTuple(Relation rel)
...
@@ -1183,7 +1183,7 @@ DeletePgTypeTuple(Relation rel)
* we release the read lock on pg_type. -mer 13 Aug 1991
* we release the read lock on pg_type. -mer 13 Aug 1991
* ----------------
* ----------------
*/
*/
heap_delete
(
pg_type_desc
,
&
tup
->
t_
ctid
);
heap_delete
(
pg_type_desc
,
&
tup
->
t_
self
);
heap_endscan
(
pg_type_scan
);
heap_endscan
(
pg_type_scan
);
heap_close
(
pg_type_desc
);
heap_close
(
pg_type_desc
);
...
@@ -1604,7 +1604,7 @@ RemoveAttrDefault(Relation rel)
...
@@ -1604,7 +1604,7 @@ RemoveAttrDefault(Relation rel)
adscan
=
heap_beginscan
(
adrel
,
0
,
SnapshotNow
,
1
,
&
key
);
adscan
=
heap_beginscan
(
adrel
,
0
,
SnapshotNow
,
1
,
&
key
);
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
adscan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
adscan
,
0
)))
heap_delete
(
adrel
,
&
tup
->
t_
ctid
);
heap_delete
(
adrel
,
&
tup
->
t_
self
);
heap_endscan
(
adscan
);
heap_endscan
(
adscan
);
...
@@ -1631,7 +1631,7 @@ RemoveRelCheck(Relation rel)
...
@@ -1631,7 +1631,7 @@ RemoveRelCheck(Relation rel)
rcscan
=
heap_beginscan
(
rcrel
,
0
,
SnapshotNow
,
1
,
&
key
);
rcscan
=
heap_beginscan
(
rcrel
,
0
,
SnapshotNow
,
1
,
&
key
);
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
rcscan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
rcscan
,
0
)))
heap_delete
(
rcrel
,
&
tup
->
t_
ctid
);
heap_delete
(
rcrel
,
&
tup
->
t_
self
);
heap_endscan
(
rcscan
);
heap_endscan
(
rcscan
);
...
...
src/backend/catalog/index.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.6
3 1998/09/10 15:32:16
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.6
4 1998/11/27 19:51:49
vadim Exp $
*
*
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
...
@@ -150,7 +150,7 @@ RelationNameGetObjectId(char *relationName,
...
@@ -150,7 +150,7 @@ RelationNameGetObjectId(char *relationName,
0
,
0
,
0
);
0
,
0
,
0
);
if
(
HeapTupleIsValid
(
tuple
))
if
(
HeapTupleIsValid
(
tuple
))
return
tuple
->
t_oid
;
return
tuple
->
t_
data
->
t_
oid
;
else
else
return
InvalidOid
;
return
InvalidOid
;
}
}
...
@@ -176,7 +176,7 @@ RelationNameGetObjectId(char *relationName,
...
@@ -176,7 +176,7 @@ RelationNameGetObjectId(char *relationName,
if
(
!
HeapTupleIsValid
(
pg_class_tuple
))
if
(
!
HeapTupleIsValid
(
pg_class_tuple
))
relationObjectId
=
InvalidOid
;
relationObjectId
=
InvalidOid
;
else
else
relationObjectId
=
pg_class_tuple
->
t_oid
;
relationObjectId
=
pg_class_tuple
->
t_
data
->
t_
oid
;
/* ----------------
/* ----------------
* cleanup and return results
* cleanup and return results
...
@@ -412,7 +412,7 @@ ConstructTupleDescriptor(Oid heapoid,
...
@@ -412,7 +412,7 @@ ConstructTupleDescriptor(Oid heapoid,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"create index: type '%s' undefined"
,
elog
(
ERROR
,
"create index: type '%s' undefined"
,
IndexKeyType
->
name
);
IndexKeyType
->
name
);
((
Form_pg_attribute
)
to
)
->
atttypid
=
tup
->
t_oid
;
((
Form_pg_attribute
)
to
)
->
atttypid
=
tup
->
t_
data
->
t_
oid
;
((
Form_pg_attribute
)
to
)
->
attbyval
=
((
Form_pg_attribute
)
to
)
->
attbyval
=
((
Form_pg_type
)
GETSTRUCT
(
tup
))
->
typbyval
;
((
Form_pg_type
)
GETSTRUCT
(
tup
))
->
typbyval
;
((
Form_pg_attribute
)
to
)
->
attlen
=
((
Form_pg_attribute
)
to
)
->
attlen
=
...
@@ -558,7 +558,7 @@ UpdateRelationRelation(Relation indexRelation)
...
@@ -558,7 +558,7 @@ UpdateRelationRelation(Relation indexRelation)
* company.
* company.
* ----------------
* ----------------
*/
*/
tuple
->
t_oid
=
RelationGetRelid
(
indexRelation
);
tuple
->
t_
data
->
t_
oid
=
RelationGetRelid
(
indexRelation
);
heap_insert
(
pg_class
,
tuple
);
heap_insert
(
pg_class
,
tuple
);
/*
/*
...
@@ -575,7 +575,7 @@ UpdateRelationRelation(Relation indexRelation)
...
@@ -575,7 +575,7 @@ UpdateRelationRelation(Relation indexRelation)
CatalogCloseIndices
(
Num_pg_class_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_class_indices
,
idescs
);
}
}
tupleOid
=
tuple
->
t_oid
;
tupleOid
=
tuple
->
t_
data
->
t_
oid
;
pfree
(
tuple
);
pfree
(
tuple
);
heap_close
(
pg_class
);
heap_close
(
pg_class
);
...
@@ -913,7 +913,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
...
@@ -913,7 +913,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
newtup
=
heap_modifytuple
(
tuple
,
pg_index
,
values
,
nulls
,
replace
);
newtup
=
heap_modifytuple
(
tuple
,
pg_index
,
values
,
nulls
,
replace
);
heap_replace
(
pg_index
,
&
newtup
->
t_
ctid
,
newtup
);
heap_replace
(
pg_index
,
&
newtup
->
t_
self
,
newtup
);
pfree
(
newtup
);
pfree
(
newtup
);
heap_close
(
pg_index
);
heap_close
(
pg_index
);
...
@@ -1104,7 +1104,7 @@ index_create(char *heapRelationName,
...
@@ -1104,7 +1104,7 @@ index_create(char *heapRelationName,
func_error
(
"index_create"
,
FIgetname
(
funcInfo
),
func_error
(
"index_create"
,
FIgetname
(
funcInfo
),
FIgetnArgs
(
funcInfo
),
FIgetArglist
(
funcInfo
),
NULL
);
FIgetnArgs
(
funcInfo
),
FIgetArglist
(
funcInfo
),
NULL
);
}
}
FIgetProcOid
(
funcInfo
)
=
proc_tup
->
t_oid
;
FIgetProcOid
(
funcInfo
)
=
proc_tup
->
t_
data
->
t_
oid
;
}
}
/* ----------------
/* ----------------
...
@@ -1195,7 +1195,7 @@ index_destroy(Oid indexId)
...
@@ -1195,7 +1195,7 @@ index_destroy(Oid indexId)
AssertState
(
HeapTupleIsValid
(
tuple
));
AssertState
(
HeapTupleIsValid
(
tuple
));
heap_delete
(
relationRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
relationRelation
,
&
tuple
->
t_
self
);
pfree
(
tuple
);
pfree
(
tuple
);
heap_close
(
relationRelation
);
heap_close
(
relationRelation
);
...
@@ -1212,7 +1212,7 @@ index_destroy(Oid indexId)
...
@@ -1212,7 +1212,7 @@ index_destroy(Oid indexId)
Int16GetDatum
(
attnum
),
Int16GetDatum
(
attnum
),
0
,
0
)))
0
,
0
)))
{
{
heap_delete
(
attributeRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
attributeRelation
,
&
tuple
->
t_
self
);
pfree
(
tuple
);
pfree
(
tuple
);
attnum
++
;
attnum
++
;
}
}
...
@@ -1232,7 +1232,7 @@ index_destroy(Oid indexId)
...
@@ -1232,7 +1232,7 @@ index_destroy(Oid indexId)
indexRelation
=
heap_openr
(
IndexRelationName
);
indexRelation
=
heap_openr
(
IndexRelationName
);
heap_delete
(
indexRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
indexRelation
,
&
tuple
->
t_
self
);
pfree
(
tuple
);
pfree
(
tuple
);
heap_close
(
indexRelation
);
heap_close
(
indexRelation
);
...
@@ -1424,7 +1424,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
...
@@ -1424,7 +1424,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
values
[
Anum_pg_class_relhasindex
-
1
]
=
CharGetDatum
(
hasindex
);
values
[
Anum_pg_class_relhasindex
-
1
]
=
CharGetDatum
(
hasindex
);
newtup
=
heap_modifytuple
(
tuple
,
pg_class
,
values
,
nulls
,
replace
);
newtup
=
heap_modifytuple
(
tuple
,
pg_class
,
values
,
nulls
,
replace
);
heap_replace
(
pg_class
,
&
tuple
->
t_
ctid
,
newtup
);
heap_replace
(
pg_class
,
&
tuple
->
t_
self
,
newtup
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
idescs
);
CatalogIndexInsert
(
idescs
,
Num_pg_class_indices
,
pg_class
,
newtup
);
CatalogIndexInsert
(
idescs
,
Num_pg_class_indices
,
pg_class
,
newtup
);
CatalogCloseIndices
(
Num_pg_class_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_class_indices
,
idescs
);
...
@@ -1626,10 +1626,10 @@ DefaultBuild(Relation heapRelation,
...
@@ -1626,10 +1626,10 @@ DefaultBuild(Relation heapRelation,
datum
,
datum
,
nullv
);
nullv
);
indexTuple
->
t_tid
=
heapTuple
->
t_
ctid
;
indexTuple
->
t_tid
=
heapTuple
->
t_
self
;
insertResult
=
index_insert
(
indexRelation
,
datum
,
nullv
,
insertResult
=
index_insert
(
indexRelation
,
datum
,
nullv
,
&
(
heapTuple
->
t_
ctid
),
heapRelation
);
&
(
heapTuple
->
t_
self
),
heapRelation
);
if
(
insertResult
)
if
(
insertResult
)
pfree
(
insertResult
);
pfree
(
insertResult
);
...
...
src/backend/catalog/indexing.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.3
3 1998/10/02 05:10:10 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.3
4 1998/11/27 19:51:50 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -161,7 +161,7 @@ CatalogIndexInsert(Relation *idescs,
...
@@ -161,7 +161,7 @@ CatalogIndexInsert(Relation *idescs,
finfoP
);
finfoP
);
indexRes
=
index_insert
(
idescs
[
i
],
datum
,
nulls
,
indexRes
=
index_insert
(
idescs
[
i
],
datum
,
nulls
,
&
heapTuple
->
t_
ctid
,
heapRelation
);
&
heapTuple
->
t_
self
,
heapRelation
);
if
(
indexRes
)
if
(
indexRes
)
pfree
(
indexRes
);
pfree
(
indexRes
);
...
@@ -230,28 +230,30 @@ CatalogIndexFetchTuple(Relation heapRelation,
...
@@ -230,28 +230,30 @@ CatalogIndexFetchTuple(Relation heapRelation,
{
{
IndexScanDesc
sd
;
IndexScanDesc
sd
;
RetrieveIndexResult
indexRes
;
RetrieveIndexResult
indexRes
;
HeapTuple
tuple
=
NULL
;
HeapTupleData
tuple
;
HeapTuple
result
=
NULL
;
Buffer
buffer
;
Buffer
buffer
;
sd
=
index_beginscan
(
idesc
,
false
,
num_keys
,
skey
);
sd
=
index_beginscan
(
idesc
,
false
,
num_keys
,
skey
);
tuple
.
t_data
=
NULL
;
while
((
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
)))
while
((
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
)))
{
{
tuple
=
heap_fetch
(
heapRelation
,
SnapshotNow
,
&
indexRes
->
heap_iptr
,
tuple
.
t_self
=
indexRes
->
heap_iptr
;
&
buffer
);
heap_fetch
(
heapRelation
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
!=
NULL
)
break
;
break
;
}
}
if
(
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
!=
NULL
)
{
{
tuple
=
heap_copytuple
(
tuple
);
result
=
heap_copytuple
(
&
tuple
);
ReleaseBuffer
(
buffer
);
ReleaseBuffer
(
buffer
);
}
}
index_endscan
(
sd
);
index_endscan
(
sd
);
pfree
(
sd
);
pfree
(
sd
);
return
tuple
;
return
result
;
}
}
...
...
src/backend/catalog/pg_aggregate.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.1
7 1998/09/01 04:27:34 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.1
8 1998/11/27 19:51:50 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -95,7 +95,7 @@ AggregateCreate(char *aggName,
...
@@ -95,7 +95,7 @@ AggregateCreate(char *aggName,
0
,
0
,
0
);
0
,
0
,
0
);
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
aggbasetypeName
);
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
aggbasetypeName
);
xbase
=
tup
->
t_oid
;
xbase
=
tup
->
t_
data
->
t_
oid
;
if
(
aggtransfn1Name
)
if
(
aggtransfn1Name
)
{
{
...
@@ -105,7 +105,7 @@ AggregateCreate(char *aggName,
...
@@ -105,7 +105,7 @@ AggregateCreate(char *aggName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
aggtransfn1typeName
);
aggtransfn1typeName
);
xret1
=
tup
->
t_oid
;
xret1
=
tup
->
t_
data
->
t_
oid
;
fnArgs
[
0
]
=
xret1
;
fnArgs
[
0
]
=
xret1
;
fnArgs
[
1
]
=
xbase
;
fnArgs
[
1
]
=
xbase
;
...
@@ -121,7 +121,7 @@ AggregateCreate(char *aggName,
...
@@ -121,7 +121,7 @@ AggregateCreate(char *aggName,
elog
(
ERROR
,
"AggregateCreate: return type of '%s' is not '%s'"
,
elog
(
ERROR
,
"AggregateCreate: return type of '%s' is not '%s'"
,
aggtransfn1Name
,
aggtransfn1Name
,
aggtransfn1typeName
);
aggtransfn1typeName
);
xfn1
=
tup
->
t_oid
;
xfn1
=
tup
->
t_
data
->
t_
oid
;
if
(
!
OidIsValid
(
xfn1
)
||
!
OidIsValid
(
xret1
)
||
if
(
!
OidIsValid
(
xfn1
)
||
!
OidIsValid
(
xret1
)
||
!
OidIsValid
(
xbase
))
!
OidIsValid
(
xbase
))
elog
(
ERROR
,
"AggregateCreate: bogus function '%s'"
,
aggfinalfnName
);
elog
(
ERROR
,
"AggregateCreate: bogus function '%s'"
,
aggfinalfnName
);
...
@@ -135,7 +135,7 @@ AggregateCreate(char *aggName,
...
@@ -135,7 +135,7 @@ AggregateCreate(char *aggName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
elog
(
ERROR
,
"AggregateCreate: Type '%s' undefined"
,
aggtransfn2typeName
);
aggtransfn2typeName
);
xret2
=
tup
->
t_oid
;
xret2
=
tup
->
t_
data
->
t_
oid
;
fnArgs
[
0
]
=
xret2
;
fnArgs
[
0
]
=
xret2
;
fnArgs
[
1
]
=
0
;
fnArgs
[
1
]
=
0
;
...
@@ -150,7 +150,7 @@ AggregateCreate(char *aggName,
...
@@ -150,7 +150,7 @@ AggregateCreate(char *aggName,
if
(((
Form_pg_proc
)
GETSTRUCT
(
tup
))
->
prorettype
!=
xret2
)
if
(((
Form_pg_proc
)
GETSTRUCT
(
tup
))
->
prorettype
!=
xret2
)
elog
(
ERROR
,
"AggregateCreate: return type of '%s' is not '%s'"
,
elog
(
ERROR
,
"AggregateCreate: return type of '%s' is not '%s'"
,
aggtransfn2Name
,
aggtransfn2typeName
);
aggtransfn2Name
,
aggtransfn2typeName
);
xfn2
=
tup
->
t_oid
;
xfn2
=
tup
->
t_
data
->
t_
oid
;
if
(
!
OidIsValid
(
xfn2
)
||
!
OidIsValid
(
xret2
))
if
(
!
OidIsValid
(
xfn2
)
||
!
OidIsValid
(
xret2
))
elog
(
ERROR
,
"AggregateCreate: bogus function '%s'"
,
aggfinalfnName
);
elog
(
ERROR
,
"AggregateCreate: bogus function '%s'"
,
aggfinalfnName
);
}
}
...
@@ -183,7 +183,7 @@ AggregateCreate(char *aggName,
...
@@ -183,7 +183,7 @@ AggregateCreate(char *aggName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"AggregateCreate: '%s'('%s','%s') does not exist"
,
elog
(
ERROR
,
"AggregateCreate: '%s'('%s','%s') does not exist"
,
aggfinalfnName
,
aggtransfn1typeName
,
aggtransfn2typeName
);
aggfinalfnName
,
aggtransfn1typeName
,
aggtransfn2typeName
);
ffn
=
tup
->
t_oid
;
ffn
=
tup
->
t_
data
->
t_
oid
;
proc
=
(
Form_pg_proc
)
GETSTRUCT
(
tup
);
proc
=
(
Form_pg_proc
)
GETSTRUCT
(
tup
);
fret
=
proc
->
prorettype
;
fret
=
proc
->
prorettype
;
if
(
!
OidIsValid
(
ffn
)
||
!
OidIsValid
(
fret
))
if
(
!
OidIsValid
(
ffn
)
||
!
OidIsValid
(
fret
))
...
...
src/backend/catalog/pg_operator.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.
29 1998/09/01 04:27:36 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.
30 1998/11/27 19:51:50 vadim
Exp $
*
*
* NOTES
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
* these routines moved here from commands/define.c and somewhat cleaned up.
...
@@ -125,7 +125,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
...
@@ -125,7 +125,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
* ----------------
* ----------------
*/
*/
tup
=
heap_getnext
(
pg_operator_scan
,
0
);
tup
=
heap_getnext
(
pg_operator_scan
,
0
);
operatorObjectId
=
HeapTupleIsValid
(
tup
)
?
tup
->
t_oid
:
InvalidOid
;
operatorObjectId
=
HeapTupleIsValid
(
tup
)
?
tup
->
t_
data
->
t_
oid
:
InvalidOid
;
/* ----------------
/* ----------------
* close the scan and return the oid.
* close the scan and return the oid.
...
@@ -279,7 +279,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
...
@@ -279,7 +279,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
* ----------------
* ----------------
*/
*/
heap_insert
(
pg_operator_desc
,
tup
);
heap_insert
(
pg_operator_desc
,
tup
);
operatorObjectId
=
tup
->
t_oid
;
operatorObjectId
=
tup
->
t_
data
->
t_
oid
;
/* ----------------
/* ----------------
* free the tuple and return the operator oid
* free the tuple and return the operator oid
...
@@ -413,7 +413,7 @@ OperatorShellMake(char *operatorName,
...
@@ -413,7 +413,7 @@ OperatorShellMake(char *operatorName,
* if the operator shell is being filled in
* if the operator shell is being filled in
* access the catalog in order to get a valid buffer
* access the catalog in order to get a valid buffer
* create a tuple using ModifyHeapTuple
* create a tuple using ModifyHeapTuple
* get the t_
ctid
from the modified tuple and call RelationReplaceHeapTuple
* get the t_
self
from the modified tuple and call RelationReplaceHeapTuple
* else if a new operator is being created
* else if a new operator is being created
* create a tuple using heap_formtuple
* create a tuple using heap_formtuple
* call heap_insert
* call heap_insert
...
@@ -544,7 +544,7 @@ OperatorDef(char *operatorName,
...
@@ -544,7 +544,7 @@ OperatorDef(char *operatorName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
func_error
(
"OperatorDef"
,
procedureName
,
nargs
,
typeId
,
NULL
);
func_error
(
"OperatorDef"
,
procedureName
,
nargs
,
typeId
,
NULL
);
values
[
Anum_pg_operator_oprcode
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_oid
);
values
[
Anum_pg_operator_oprcode
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_
data
->
t_
oid
);
values
[
Anum_pg_operator_oprresult
-
1
]
=
values
[
Anum_pg_operator_oprresult
-
1
]
=
ObjectIdGetDatum
(((
Form_pg_proc
)
ObjectIdGetDatum
(((
Form_pg_proc
)
GETSTRUCT
(
tup
))
->
prorettype
);
GETSTRUCT
(
tup
))
->
prorettype
);
...
@@ -569,7 +569,7 @@ OperatorDef(char *operatorName,
...
@@ -569,7 +569,7 @@ OperatorDef(char *operatorName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
func_error
(
"OperatorDef"
,
restrictionName
,
5
,
typeId
,
NULL
);
func_error
(
"OperatorDef"
,
restrictionName
,
5
,
typeId
,
NULL
);
values
[
Anum_pg_operator_oprrest
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_oid
);
values
[
Anum_pg_operator_oprrest
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_
data
->
t_
oid
);
}
}
else
else
values
[
Anum_pg_operator_oprrest
-
1
]
=
ObjectIdGetDatum
(
InvalidOid
);
values
[
Anum_pg_operator_oprrest
-
1
]
=
ObjectIdGetDatum
(
InvalidOid
);
...
@@ -595,7 +595,7 @@ OperatorDef(char *operatorName,
...
@@ -595,7 +595,7 @@ OperatorDef(char *operatorName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
func_error
(
"OperatorDef"
,
joinName
,
5
,
typeId
,
NULL
);
func_error
(
"OperatorDef"
,
joinName
,
5
,
typeId
,
NULL
);
values
[
Anum_pg_operator_oprjoin
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_oid
);
values
[
Anum_pg_operator_oprjoin
-
1
]
=
ObjectIdGetDatum
(
tup
->
t_
data
->
t_
oid
);
}
}
else
else
values
[
Anum_pg_operator_oprjoin
-
1
]
=
ObjectIdGetDatum
(
InvalidOid
);
values
[
Anum_pg_operator_oprjoin
-
1
]
=
ObjectIdGetDatum
(
InvalidOid
);
...
@@ -685,7 +685,7 @@ OperatorDef(char *operatorName,
...
@@ -685,7 +685,7 @@ OperatorDef(char *operatorName,
/* last three fields were filled in first */
/* last three fields were filled in first */
/*
/*
* If we are adding to an operator shell, get its t_
ctid
* If we are adding to an operator shell, get its t_
self
*/
*/
pg_operator_desc
=
heap_openr
(
OperatorRelationName
);
pg_operator_desc
=
heap_openr
(
OperatorRelationName
);
...
@@ -711,7 +711,7 @@ OperatorDef(char *operatorName,
...
@@ -711,7 +711,7 @@ OperatorDef(char *operatorName,
replaces
);
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
ctid
,
tup
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
self
,
tup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
}
}
else
else
...
@@ -725,7 +725,7 @@ OperatorDef(char *operatorName,
...
@@ -725,7 +725,7 @@ OperatorDef(char *operatorName,
tup
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
tup
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
heap_insert
(
pg_operator_desc
,
tup
);
heap_insert
(
pg_operator_desc
,
tup
);
operatorObjectId
=
tup
->
t_oid
;
operatorObjectId
=
tup
->
t_
data
->
t_
oid
;
}
}
heap_close
(
pg_operator_desc
);
heap_close
(
pg_operator_desc
);
...
@@ -830,7 +830,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -830,7 +830,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
replaces
);
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
ctid
,
tup
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
self
,
tup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
}
}
...
@@ -855,7 +855,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -855,7 +855,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
replaces
);
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
ctid
,
tup
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
self
,
tup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
values
[
Anum_pg_operator_oprcom
-
1
]
=
(
Datum
)
NULL
;
values
[
Anum_pg_operator_oprcom
-
1
]
=
(
Datum
)
NULL
;
...
@@ -884,7 +884,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
...
@@ -884,7 +884,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
replaces
);
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
ctid
,
tup
);
heap_replace
(
pg_operator_desc
,
&
tup
->
t_
self
,
tup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
}
}
...
...
src/backend/catalog/pg_proc.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.2
3 1998/09/01 04:27:37 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.2
4 1998/11/27 19:51:51 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -144,7 +144,7 @@ ProcedureCreate(char *procedureName,
...
@@ -144,7 +144,7 @@ ProcedureCreate(char *procedureName,
0
,
0
,
0
);
0
,
0
,
0
);
pfree
(
prosrctext
);
pfree
(
prosrctext
);
if
(
HeapTupleIsValid
(
tup
))
if
(
HeapTupleIsValid
(
tup
))
return
tup
->
t_oid
;
return
tup
->
t_
data
->
t_
oid
;
}
}
}
}
...
@@ -155,7 +155,7 @@ ProcedureCreate(char *procedureName,
...
@@ -155,7 +155,7 @@ ProcedureCreate(char *procedureName,
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"ProcedureCreate: no such language %s"
,
languageName
);
elog
(
ERROR
,
"ProcedureCreate: no such language %s"
,
languageName
);
languageObjectId
=
tup
->
t_oid
;
languageObjectId
=
tup
->
t_
data
->
t_
oid
;
if
(
strcmp
(
returnTypeName
,
"opaque"
)
==
0
)
if
(
strcmp
(
returnTypeName
,
"opaque"
)
==
0
)
{
{
...
@@ -276,5 +276,5 @@ ProcedureCreate(char *procedureName,
...
@@ -276,5 +276,5 @@ ProcedureCreate(char *procedureName,
CatalogCloseIndices
(
Num_pg_proc_indices
,
idescs
);
CatalogCloseIndices
(
Num_pg_proc_indices
,
idescs
);
}
}
heap_close
(
rel
);
heap_close
(
rel
);
return
tup
->
t_oid
;
return
tup
->
t_
data
->
t_
oid
;
}
}
src/backend/catalog/pg_type.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.3
0 1998/09/01 04:27:39 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.3
1 1998/11/27 19:51:51 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -99,7 +99,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
...
@@ -99,7 +99,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
heap_endscan
(
scan
);
heap_endscan
(
scan
);
*
defined
=
(
bool
)
((
Form_pg_type
)
GETSTRUCT
(
tup
))
->
typisdefined
;
*
defined
=
(
bool
)
((
Form_pg_type
)
GETSTRUCT
(
tup
))
->
typisdefined
;
return
tup
->
t_oid
;
return
tup
->
t_
data
->
t_
oid
;
}
}
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
...
@@ -212,7 +212,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
...
@@ -212,7 +212,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
* ----------------
* ----------------
*/
*/
heap_insert
(
pg_type_desc
,
tup
);
heap_insert
(
pg_type_desc
,
tup
);
typoid
=
tup
->
t_oid
;
typoid
=
tup
->
t_
data
->
t_
oid
;
if
(
RelationGetForm
(
pg_type_desc
)
->
relhasindex
)
if
(
RelationGetForm
(
pg_type_desc
)
->
relhasindex
)
{
{
...
@@ -430,7 +430,7 @@ TypeCreate(char *typeName,
...
@@ -430,7 +430,7 @@ TypeCreate(char *typeName,
func_error
(
"TypeCreate"
,
procname
,
1
,
argList
,
NULL
);
func_error
(
"TypeCreate"
,
procname
,
1
,
argList
,
NULL
);
}
}
values
[
i
++
]
=
(
Datum
)
tup
->
t_oid
;
/* 11 - 14 */
values
[
i
++
]
=
(
Datum
)
tup
->
t_
data
->
t_
oid
;
/* 11 - 14 */
}
}
/* ----------------
/* ----------------
...
@@ -484,10 +484,10 @@ TypeCreate(char *typeName,
...
@@ -484,10 +484,10 @@ TypeCreate(char *typeName,
replaces
);
replaces
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_type_desc
,
&
tup
->
t_
ctid
,
tup
);
heap_replace
(
pg_type_desc
,
&
tup
->
t_
self
,
tup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
typeObjectId
=
tup
->
t_oid
;
typeObjectId
=
tup
->
t_
data
->
t_
oid
;
}
}
else
else
{
{
...
@@ -499,7 +499,7 @@ TypeCreate(char *typeName,
...
@@ -499,7 +499,7 @@ TypeCreate(char *typeName,
heap_insert
(
pg_type_desc
,
tup
);
heap_insert
(
pg_type_desc
,
tup
);
typeObjectId
=
tup
->
t_oid
;
typeObjectId
=
tup
->
t_
data
->
t_
oid
;
}
}
/* ----------------
/* ----------------
...
@@ -561,7 +561,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
...
@@ -561,7 +561,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
namestrcpy
(
&
(((
Form_pg_type
)
GETSTRUCT
(
oldtup
))
->
typname
),
newTypeName
);
namestrcpy
(
&
(((
Form_pg_type
)
GETSTRUCT
(
oldtup
))
->
typname
),
newTypeName
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
pg_type_desc
,
&
oldtup
->
t_
ctid
,
oldtup
);
heap_replace
(
pg_type_desc
,
&
oldtup
->
t_
self
,
oldtup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
/* update the system catalog indices */
/* update the system catalog indices */
...
...
src/backend/commands/async.c
View file @
6beba218
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.4
1 1998/10/06 02:39:59 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.4
2 1998/11/27 19:51:53 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -321,7 +321,7 @@ Async_Unlisten(char *relname, int pid)
...
@@ -321,7 +321,7 @@ Async_Unlisten(char *relname, int pid)
{
{
lRel
=
heap_openr
(
ListenerRelationName
);
lRel
=
heap_openr
(
ListenerRelationName
);
RelationSetLockForWrite
(
lRel
);
RelationSetLockForWrite
(
lRel
);
heap_delete
(
lRel
,
&
lTuple
->
t_
ctid
);
heap_delete
(
lRel
,
&
lTuple
->
t_
self
);
RelationUnsetLockForWrite
(
lRel
);
RelationUnsetLockForWrite
(
lRel
);
heap_close
(
lRel
);
heap_close
(
lRel
);
}
}
...
@@ -369,7 +369,7 @@ Async_UnlistenAll()
...
@@ -369,7 +369,7 @@ Async_UnlistenAll()
sRel
=
heap_beginscan
(
lRel
,
0
,
SnapshotNow
,
1
,
key
);
sRel
=
heap_beginscan
(
lRel
,
0
,
SnapshotNow
,
1
,
key
);
while
(
HeapTupleIsValid
(
lTuple
=
heap_getnext
(
sRel
,
0
)))
while
(
HeapTupleIsValid
(
lTuple
=
heap_getnext
(
sRel
,
0
)))
heap_delete
(
lRel
,
&
lTuple
->
t_
ctid
);
heap_delete
(
lRel
,
&
lTuple
->
t_
self
);
heap_endscan
(
sRel
);
heap_endscan
(
sRel
);
RelationUnsetLockForWrite
(
lRel
);
RelationUnsetLockForWrite
(
lRel
);
...
@@ -516,7 +516,7 @@ AtCommit_Notify()
...
@@ -516,7 +516,7 @@ AtCommit_Notify()
* but as far as I can see we should just do it for any
* but as far as I can see we should just do it for any
* failure (certainly at least for EPERM too...)
* failure (certainly at least for EPERM too...)
*/
*/
heap_delete
(
lRel
,
&
lTuple
->
t_
ctid
);
heap_delete
(
lRel
,
&
lTuple
->
t_
self
);
}
}
else
else
#endif
#endif
...
@@ -527,7 +527,7 @@ AtCommit_Notify()
...
@@ -527,7 +527,7 @@ AtCommit_Notify()
{
{
rTuple
=
heap_modifytuple
(
lTuple
,
lRel
,
rTuple
=
heap_modifytuple
(
lTuple
,
lRel
,
value
,
nulls
,
repl
);
value
,
nulls
,
repl
);
heap_replace
(
lRel
,
&
lTuple
->
t_
ctid
,
rTuple
);
heap_replace
(
lRel
,
&
lTuple
->
t_
self
,
rTuple
);
}
}
}
}
}
}
...
@@ -772,7 +772,7 @@ ProcessIncomingNotify(void)
...
@@ -772,7 +772,7 @@ ProcessIncomingNotify(void)
NotifyMyFrontEnd
(
relname
,
sourcePID
);
NotifyMyFrontEnd
(
relname
,
sourcePID
);
/* Rewrite the tuple with 0 in notification column */
/* Rewrite the tuple with 0 in notification column */
rTuple
=
heap_modifytuple
(
lTuple
,
lRel
,
value
,
nulls
,
repl
);
rTuple
=
heap_modifytuple
(
lTuple
,
lRel
,
value
,
nulls
,
repl
);
heap_replace
(
lRel
,
&
lTuple
->
t_
ctid
,
rTuple
);
heap_replace
(
lRel
,
&
lTuple
->
t_
self
,
rTuple
);
}
}
}
}
heap_endscan
(
sRel
);
heap_endscan
(
sRel
);
...
...
src/backend/commands/cluster.c
View file @
6beba218
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.3
2 1998/09/23 04:22:01 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.3
3 1998/11/27 19:51:54 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -335,8 +335,7 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
...
@@ -335,8 +335,7 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
LocalOldIndex
;
LocalOldIndex
;
IndexScanDesc
ScanDesc
;
IndexScanDesc
ScanDesc
;
RetrieveIndexResult
ScanResult
;
RetrieveIndexResult
ScanResult
;
ItemPointer
HeapTid
;
HeapTupleData
LocalHeapTuple
;
HeapTuple
LocalHeapTuple
;
Buffer
LocalBuffer
;
Buffer
LocalBuffer
;
Oid
OIDNewHeapInsert
;
Oid
OIDNewHeapInsert
;
...
@@ -353,10 +352,10 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
...
@@ -353,10 +352,10 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
while
((
ScanResult
=
index_getnext
(
ScanDesc
,
ForwardScanDirection
))
!=
NULL
)
while
((
ScanResult
=
index_getnext
(
ScanDesc
,
ForwardScanDirection
))
!=
NULL
)
{
{
HeapTid
=
&
ScanResult
->
heap_iptr
;
LocalHeapTuple
.
t_self
=
ScanResult
->
heap_iptr
;
LocalHeapTuple
=
heap_fetch
(
LocalOldHeap
,
SnapshotNow
,
HeapTid
,
&
LocalBuffer
);
heap_fetch
(
LocalOldHeap
,
SnapshotNow
,
&
LocalHeapTuple
,
&
LocalBuffer
);
OIDNewHeapInsert
=
OIDNewHeapInsert
=
heap_insert
(
LocalNewHeap
,
LocalHeapTuple
);
heap_insert
(
LocalNewHeap
,
&
LocalHeapTuple
);
pfree
(
ScanResult
);
pfree
(
ScanResult
);
ReleaseBuffer
(
LocalBuffer
);
ReleaseBuffer
(
LocalBuffer
);
}
}
...
...
src/backend/commands/command.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.3
2 1998/09/01 04:27:46 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.3
3 1998/11/27 19:51:54 vadim
Exp $
*
*
* NOTES
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
* The PortalExecutorHeapMemory crap needs to be eliminated
...
@@ -405,7 +405,7 @@ PerformAddAttribute(char *relationName,
...
@@ -405,7 +405,7 @@ PerformAddAttribute(char *relationName,
if
(
hasindex
)
if
(
hasindex
)
CatalogOpenIndices
(
Num_pg_attr_indices
,
Name_pg_attr_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_attr_indices
,
Name_pg_attr_indices
,
idescs
);
attributeD
.
attrelid
=
reltup
->
t_oid
;
attributeD
.
attrelid
=
reltup
->
t_
data
->
t_
oid
;
attributeTuple
=
heap_addheader
(
Natts_pg_attribute
,
attributeTuple
=
heap_addheader
(
Natts_pg_attribute
,
sizeof
attributeD
,
sizeof
attributeD
,
...
@@ -422,7 +422,7 @@ PerformAddAttribute(char *relationName,
...
@@ -422,7 +422,7 @@ PerformAddAttribute(char *relationName,
int
attnelems
;
int
attnelems
;
tup
=
SearchSysCacheTuple
(
ATTNAME
,
tup
=
SearchSysCacheTuple
(
ATTNAME
,
ObjectIdGetDatum
(
reltup
->
t_oid
),
ObjectIdGetDatum
(
reltup
->
t_
data
->
t_
oid
),
PointerGetDatum
(
colDef
->
colname
),
PointerGetDatum
(
colDef
->
colname
),
0
,
0
);
0
,
0
);
...
@@ -456,7 +456,7 @@ PerformAddAttribute(char *relationName,
...
@@ -456,7 +456,7 @@ PerformAddAttribute(char *relationName,
if
(
!
HeapTupleIsValid
(
typeTuple
))
if
(
!
HeapTupleIsValid
(
typeTuple
))
elog
(
ERROR
,
"Add: type
\"
%s
\"
nonexistent"
,
typename
);
elog
(
ERROR
,
"Add: type
\"
%s
\"
nonexistent"
,
typename
);
namestrcpy
(
&
(
attribute
->
attname
),
colDef
->
colname
);
namestrcpy
(
&
(
attribute
->
attname
),
colDef
->
colname
);
attribute
->
atttypid
=
typeTuple
->
t_oid
;
attribute
->
atttypid
=
typeTuple
->
t_
data
->
t_
oid
;
attribute
->
attlen
=
form
->
typlen
;
attribute
->
attlen
=
form
->
typlen
;
attributeD
.
attdisbursion
=
0
;
attributeD
.
attdisbursion
=
0
;
attribute
->
attcacheoff
=
-
1
;
attribute
->
attcacheoff
=
-
1
;
...
@@ -482,7 +482,7 @@ PerformAddAttribute(char *relationName,
...
@@ -482,7 +482,7 @@ PerformAddAttribute(char *relationName,
heap_close
(
attrdesc
);
heap_close
(
attrdesc
);
((
Form_pg_class
)
GETSTRUCT
(
reltup
))
->
relnatts
=
maxatts
;
((
Form_pg_class
)
GETSTRUCT
(
reltup
))
->
relnatts
=
maxatts
;
heap_replace
(
rel
,
&
reltup
->
t_
ctid
,
reltup
);
heap_replace
(
rel
,
&
reltup
->
t_
self
,
reltup
);
/* keep catalog indices current */
/* keep catalog indices current */
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
...
...
src/backend/commands/copy.c
View file @
6beba218
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.6
3 1998/10/26 00:59:21 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.6
4 1998/11/27 19:51:54 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -277,7 +277,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -277,7 +277,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
if
(
oids
&&
!
binary
)
if
(
oids
&&
!
binary
)
{
{
fputs
(
oidout
(
tuple
->
t_oid
),
fp
);
fputs
(
oidout
(
tuple
->
t_
data
->
t_
oid
),
fp
);
fputc
(
delim
[
0
],
fp
);
fputc
(
delim
[
0
],
fp
);
}
}
...
@@ -331,10 +331,10 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -331,10 +331,10 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
null_ct
++
;
null_ct
++
;
}
}
length
=
tuple
->
t_len
-
tuple
->
t_hoff
;
length
=
tuple
->
t_len
-
tuple
->
t_
data
->
t_
hoff
;
fwrite
(
&
length
,
sizeof
(
int32
),
1
,
fp
);
fwrite
(
&
length
,
sizeof
(
int32
),
1
,
fp
);
if
(
oids
)
if
(
oids
)
fwrite
((
char
*
)
&
tuple
->
t_oid
,
sizeof
(
int32
),
1
,
fp
);
fwrite
((
char
*
)
&
tuple
->
t_
data
->
t_
oid
,
sizeof
(
int32
),
1
,
fp
);
fwrite
(
&
null_ct
,
sizeof
(
int32
),
1
,
fp
);
fwrite
(
&
null_ct
,
sizeof
(
int32
),
1
,
fp
);
if
(
null_ct
>
0
)
if
(
null_ct
>
0
)
...
@@ -348,7 +348,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -348,7 +348,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
}
}
}
}
}
}
fwrite
((
char
*
)
tuple
+
tuple
->
t_hoff
,
length
,
1
,
fp
);
fwrite
((
char
*
)
tuple
->
t_data
+
tuple
->
t_data
->
t_hoff
,
length
,
1
,
fp
);
}
}
}
}
...
@@ -678,7 +679,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -678,7 +679,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
*/
*/
tuple
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
tuple
=
heap_formtuple
(
tupDesc
,
values
,
nulls
);
if
(
oids
)
if
(
oids
)
tuple
->
t_oid
=
loaded_oid
;
tuple
->
t_
data
->
t_
oid
=
loaded_oid
;
skip_tuple
=
false
;
skip_tuple
=
false
;
/* BEFORE ROW INSERT Triggers */
/* BEFORE ROW INSERT Triggers */
...
@@ -706,17 +707,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -706,17 +707,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
*/
*/
if
(
rel
->
rd_att
->
constr
)
if
(
rel
->
rd_att
->
constr
)
{
ExecConstraints
(
"CopyFrom"
,
rel
,
tuple
);
HeapTuple
newtuple
;
newtuple
=
ExecConstraints
(
"CopyFrom"
,
rel
,
tuple
);
if
(
newtuple
!=
tuple
)
{
pfree
(
tuple
);
tuple
=
newtuple
;
}
}
heap_insert
(
rel
,
tuple
);
heap_insert
(
rel
,
tuple
);
...
@@ -746,7 +737,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
...
@@ -746,7 +737,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
index_nulls
,
index_nulls
,
finfoP
[
i
]);
finfoP
[
i
]);
indexRes
=
index_insert
(
index_rels
[
i
],
idatum
,
index_nulls
,
indexRes
=
index_insert
(
index_rels
[
i
],
idatum
,
index_nulls
,
&
(
tuple
->
t_
ctid
),
rel
);
&
(
tuple
->
t_
self
),
rel
);
if
(
indexRes
)
if
(
indexRes
)
pfree
(
indexRes
);
pfree
(
indexRes
);
}
}
...
...
src/backend/commands/creatinh.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.3
5 1998/10/01 22:45:29 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.3
6 1998/11/27 19:51:55 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -409,10 +409,10 @@ StoreCatalogInheritance(Oid relationId, List *supers)
...
@@ -409,10 +409,10 @@ StoreCatalogInheritance(Oid relationId, List *supers)
/*
/*
* build idList for use below
* build idList for use below
*/
*/
idList
=
lappendi
(
idList
,
tuple
->
t_oid
);
idList
=
lappendi
(
idList
,
tuple
->
t_
data
->
t_
oid
);
datum
[
0
]
=
ObjectIdGetDatum
(
relationId
);
/* inhrel */
datum
[
0
]
=
ObjectIdGetDatum
(
relationId
);
/* inhrel */
datum
[
1
]
=
ObjectIdGetDatum
(
tuple
->
t_
oid
);
/* inhparent */
datum
[
1
]
=
ObjectIdGetDatum
(
tuple
->
t_
data
->
t_oid
);
/* inhparent */
datum
[
2
]
=
Int16GetDatum
(
seqNumber
);
/* inhseqno */
datum
[
2
]
=
Int16GetDatum
(
seqNumber
);
/* inhseqno */
nullarr
[
0
]
=
' '
;
nullarr
[
0
]
=
' '
;
...
...
src/backend/commands/dbcommands.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.2
5 1998/10/05 02:49:36 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.2
6 1998/11/27 19:51:56 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -251,7 +251,7 @@ check_permissions(char *command,
...
@@ -251,7 +251,7 @@ check_permissions(char *command,
Anum_pg_database_datdba
,
Anum_pg_database_datdba
,
RelationGetDescr
(
dbrel
),
RelationGetDescr
(
dbrel
),
(
char
*
)
NULL
);
(
char
*
)
NULL
);
*
dbIdP
=
dbtup
->
t_oid
;
*
dbIdP
=
dbtup
->
t_
data
->
t_
oid
;
dbtext
=
(
text
*
)
heap_getattr
(
dbtup
,
dbtext
=
(
text
*
)
heap_getattr
(
dbtup
,
Anum_pg_database_datpath
,
Anum_pg_database_datpath
,
RelationGetDescr
(
dbrel
),
RelationGetDescr
(
dbrel
),
...
...
src/backend/commands/defind.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.2
7 1998/09/23 04:22:03 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.2
8 1998/11/27 19:51:56 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -105,7 +105,7 @@ DefineIndex(char *heapRelationName,
...
@@ -105,7 +105,7 @@ DefineIndex(char *heapRelationName,
elog
(
ERROR
,
"DefineIndex: %s relation not found"
,
elog
(
ERROR
,
"DefineIndex: %s relation not found"
,
heapRelationName
);
heapRelationName
);
}
}
relationId
=
tuple
->
t_oid
;
relationId
=
tuple
->
t_
data
->
t_
oid
;
if
(
unique
&&
strcmp
(
accessMethodName
,
"btree"
)
!=
0
)
if
(
unique
&&
strcmp
(
accessMethodName
,
"btree"
)
!=
0
)
elog
(
ERROR
,
"DefineIndex: unique indices are only available with the btree access method"
);
elog
(
ERROR
,
"DefineIndex: unique indices are only available with the btree access method"
);
...
@@ -124,7 +124,7 @@ DefineIndex(char *heapRelationName,
...
@@ -124,7 +124,7 @@ DefineIndex(char *heapRelationName,
elog
(
ERROR
,
"DefineIndex: %s access method not found"
,
elog
(
ERROR
,
"DefineIndex: %s access method not found"
,
accessMethodName
);
accessMethodName
);
}
}
accessMethodId
=
tuple
->
t_oid
;
accessMethodId
=
tuple
->
t_
data
->
t_
oid
;
/*
/*
...
@@ -250,7 +250,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
...
@@ -250,7 +250,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
elog
(
ERROR
,
"ExtendIndex: %s index not found"
,
elog
(
ERROR
,
"ExtendIndex: %s index not found"
,
indexRelationName
);
indexRelationName
);
}
}
indexId
=
tuple
->
t_oid
;
indexId
=
tuple
->
t_
data
->
t_
oid
;
accessMethodId
=
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relam
;
accessMethodId
=
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relam
;
/*
/*
...
@@ -336,7 +336,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
...
@@ -336,7 +336,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
namecpy
(
&
(
funcInfo
->
funcName
),
namecpy
(
&
(
funcInfo
->
funcName
),
&
(((
Form_pg_proc
)
GETSTRUCT
(
tuple
))
->
proname
));
&
(((
Form_pg_proc
)
GETSTRUCT
(
tuple
))
->
proname
));
FIsetProcOid
(
funcInfo
,
tuple
->
t_oid
);
FIsetProcOid
(
funcInfo
,
tuple
->
t_
data
->
t_
oid
);
}
}
heapRelation
=
heap_open
(
relationId
);
heapRelation
=
heap_open
(
relationId
);
...
@@ -429,7 +429,7 @@ FuncIndexArgs(IndexElem *funcIndex,
...
@@ -429,7 +429,7 @@ FuncIndexArgs(IndexElem *funcIndex,
elog
(
ERROR
,
"DefineIndex: %s class not found"
,
elog
(
ERROR
,
"DefineIndex: %s class not found"
,
funcIndex
->
class
);
funcIndex
->
class
);
}
}
*
opOidP
=
tuple
->
t_oid
;
*
opOidP
=
tuple
->
t_
data
->
t_
oid
;
MemSet
(
argTypes
,
0
,
8
*
sizeof
(
Oid
));
MemSet
(
argTypes
,
0
,
8
*
sizeof
(
Oid
));
...
@@ -531,7 +531,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
...
@@ -531,7 +531,7 @@ NormIndexAttrs(List *attList, /* list of IndexElem's */
elog
(
ERROR
,
"DefineIndex: %s class not found"
,
elog
(
ERROR
,
"DefineIndex: %s class not found"
,
attribute
->
class
);
attribute
->
class
);
}
}
*
classOidP
++
=
tuple
->
t_oid
;
*
classOidP
++
=
tuple
->
t_
data
->
t_
oid
;
pfree
(
atttuple
);
pfree
(
atttuple
);
}
}
}
}
...
@@ -578,5 +578,5 @@ RemoveIndex(char *name)
...
@@ -578,5 +578,5 @@ RemoveIndex(char *name)
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relkind
);
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relkind
);
}
}
index_destroy
(
tuple
->
t_oid
);
index_destroy
(
tuple
->
t_
data
->
t_
oid
);
}
}
src/backend/commands/proclang.c
View file @
6beba218
...
@@ -118,7 +118,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
...
@@ -118,7 +118,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
values
[
i
++
]
=
PointerGetDatum
(
languageName
);
values
[
i
++
]
=
PointerGetDatum
(
languageName
);
values
[
i
++
]
=
Int8GetDatum
((
bool
)
1
);
values
[
i
++
]
=
Int8GetDatum
((
bool
)
1
);
values
[
i
++
]
=
Int8GetDatum
(
stmt
->
pltrusted
);
values
[
i
++
]
=
Int8GetDatum
(
stmt
->
pltrusted
);
values
[
i
++
]
=
ObjectIdGetDatum
(
procTup
->
t_oid
);
values
[
i
++
]
=
ObjectIdGetDatum
(
procTup
->
t_
data
->
t_
oid
);
values
[
i
++
]
=
(
Datum
)
fmgr
(
F_TEXTIN
,
stmt
->
plcompiler
);
values
[
i
++
]
=
(
Datum
)
fmgr
(
F_TEXTIN
,
stmt
->
plcompiler
);
rel
=
heap_openr
(
LanguageRelationName
);
rel
=
heap_openr
(
LanguageRelationName
);
...
@@ -174,7 +174,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
...
@@ -174,7 +174,7 @@ DropProceduralLanguage(DropPLangStmt *stmt)
}
}
rel
=
heap_openr
(
LanguageRelationName
);
rel
=
heap_openr
(
LanguageRelationName
);
heap_delete
(
rel
,
&
langTup
->
t_
ctid
);
heap_delete
(
rel
,
&
langTup
->
t_
self
);
pfree
(
langTup
);
pfree
(
langTup
);
heap_close
(
rel
);
heap_close
(
rel
);
...
...
src/backend/commands/remove.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.
29 1998/09/01 04:27:57 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.
30 1998/11/27 19:51:57 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -97,12 +97,12 @@ RemoveOperator(char *operatorName, /* operator name */
...
@@ -97,12 +97,12 @@ RemoveOperator(char *operatorName, /* operator name */
#ifndef NO_SECURITY
#ifndef NO_SECURITY
userName
=
GetPgUserName
();
userName
=
GetPgUserName
();
if
(
!
pg_ownercheck
(
userName
,
if
(
!
pg_ownercheck
(
userName
,
(
char
*
)
ObjectIdGetDatum
(
tup
->
t_oid
),
(
char
*
)
ObjectIdGetDatum
(
tup
->
t_
data
->
t_
oid
),
OPROID
))
OPROID
))
elog
(
ERROR
,
"RemoveOperator: operator '%s': permission denied"
,
elog
(
ERROR
,
"RemoveOperator: operator '%s': permission denied"
,
operatorName
);
operatorName
);
#endif
#endif
heap_delete
(
relation
,
&
tup
->
t_
ctid
);
heap_delete
(
relation
,
&
tup
->
t_
self
);
}
}
else
else
{
{
...
@@ -157,7 +157,7 @@ SingleOpOperatorRemove(Oid typeOid)
...
@@ -157,7 +157,7 @@ SingleOpOperatorRemove(Oid typeOid)
key
[
0
].
sk_attno
=
attnums
[
i
];
key
[
0
].
sk_attno
=
attnums
[
i
];
scan
=
heap_beginscan
(
rel
,
0
,
SnapshotNow
,
1
,
key
);
scan
=
heap_beginscan
(
rel
,
0
,
SnapshotNow
,
1
,
key
);
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
scan
,
0
)))
heap_delete
(
rel
,
&
tup
->
t_
ctid
);
heap_delete
(
rel
,
&
tup
->
t_
self
);
heap_endscan
(
scan
);
heap_endscan
(
scan
);
}
}
heap_close
(
rel
);
heap_close
(
rel
);
...
@@ -267,8 +267,8 @@ RemoveType(char *typeName) /* type name to be removed */
...
@@ -267,8 +267,8 @@ RemoveType(char *typeName) /* type name to be removed */
}
}
relation
=
heap_openr
(
TypeRelationName
);
relation
=
heap_openr
(
TypeRelationName
);
typeOid
=
tup
->
t_oid
;
typeOid
=
tup
->
t_
data
->
t_
oid
;
heap_delete
(
relation
,
&
tup
->
t_
ctid
);
heap_delete
(
relation
,
&
tup
->
t_
self
);
/* Now, Delete the "array of" that type */
/* Now, Delete the "array of" that type */
shadow_type
=
makeArrayTypeName
(
typeName
);
shadow_type
=
makeArrayTypeName
(
typeName
);
...
@@ -281,8 +281,8 @@ RemoveType(char *typeName) /* type name to be removed */
...
@@ -281,8 +281,8 @@ RemoveType(char *typeName) /* type name to be removed */
elog
(
ERROR
,
"RemoveType: type '%s' does not exist"
,
typeName
);
elog
(
ERROR
,
"RemoveType: type '%s' does not exist"
,
typeName
);
}
}
typeOid
=
tup
->
t_oid
;
typeOid
=
tup
->
t_
data
->
t_
oid
;
heap_delete
(
relation
,
&
tup
->
t_
ctid
);
heap_delete
(
relation
,
&
tup
->
t_
self
);
heap_close
(
relation
);
heap_close
(
relation
);
}
}
...
@@ -325,7 +325,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
...
@@ -325,7 +325,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
if
(
!
HeapTupleIsValid
(
tup
))
if
(
!
HeapTupleIsValid
(
tup
))
elog
(
ERROR
,
"RemoveFunction: type '%s' not found"
,
typename
);
elog
(
ERROR
,
"RemoveFunction: type '%s' not found"
,
typename
);
argList
[
i
]
=
tup
->
t_oid
;
argList
[
i
]
=
tup
->
t_
data
->
t_
oid
;
}
}
}
}
...
@@ -357,7 +357,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
...
@@ -357,7 +357,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
elog
(
ERROR
,
"RemoveFunction: function
\"
%s
\"
is built-in"
,
functionName
);
elog
(
ERROR
,
"RemoveFunction: function
\"
%s
\"
is built-in"
,
functionName
);
}
}
heap_delete
(
relation
,
&
tup
->
t_
ctid
);
heap_delete
(
relation
,
&
tup
->
t_
self
);
heap_close
(
relation
);
heap_close
(
relation
);
}
}
...
@@ -428,7 +428,7 @@ RemoveAggregate(char *aggName, char *aggType)
...
@@ -428,7 +428,7 @@ RemoveAggregate(char *aggName, char *aggType)
aggName
);
aggName
);
}
}
}
}
heap_delete
(
relation
,
&
tup
->
t_
ctid
);
heap_delete
(
relation
,
&
tup
->
t_
self
);
heap_close
(
relation
);
heap_close
(
relation
);
}
}
src/backend/commands/rename.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.1
7 1998/09/01 04:27:59 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.1
8 1998/11/27 19:51:57 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -113,7 +113,7 @@ renameatt(char *relname,
...
@@ -113,7 +113,7 @@ renameatt(char *relname,
if
(
!
HeapTupleIsValid
(
reltup
))
if
(
!
HeapTupleIsValid
(
reltup
))
elog
(
ERROR
,
"renameatt: unknown relation:
\"
%s
\"
"
,
relname
);
elog
(
ERROR
,
"renameatt: unknown relation:
\"
%s
\"
"
,
relname
);
myrelid
=
reltup
->
t_oid
;
myrelid
=
reltup
->
t_
data
->
t_
oid
;
/* this routine is actually in the planner */
/* this routine is actually in the planner */
children
=
find_all_inheritors
(
lconsi
(
myrelid
,
NIL
),
NIL
);
children
=
find_all_inheritors
(
lconsi
(
myrelid
,
NIL
),
NIL
);
...
@@ -153,7 +153,7 @@ renameatt(char *relname,
...
@@ -153,7 +153,7 @@ renameatt(char *relname,
if
(
!
HeapTupleIsValid
(
reltup
))
if
(
!
HeapTupleIsValid
(
reltup
))
elog
(
ERROR
,
"renameatt: relation
\"
%s
\"
nonexistent"
,
relname
);
elog
(
ERROR
,
"renameatt: relation
\"
%s
\"
nonexistent"
,
relname
);
relid
=
reltup
->
t_oid
;
relid
=
reltup
->
t_
data
->
t_
oid
;
oldatttup
=
SearchSysCacheTupleCopy
(
ATTNAME
,
oldatttup
=
SearchSysCacheTupleCopy
(
ATTNAME
,
ObjectIdGetDatum
(
relid
),
ObjectIdGetDatum
(
relid
),
...
@@ -180,7 +180,7 @@ renameatt(char *relname,
...
@@ -180,7 +180,7 @@ renameatt(char *relname,
newattname
,
NAMEDATALEN
);
newattname
,
NAMEDATALEN
);
attrelation
=
heap_openr
(
AttributeRelationName
);
attrelation
=
heap_openr
(
AttributeRelationName
);
heap_replace
(
attrelation
,
&
oldatttup
->
t_
ctid
,
oldatttup
);
heap_replace
(
attrelation
,
&
oldatttup
->
t_
self
,
oldatttup
);
/* keep system catalog indices current */
/* keep system catalog indices current */
CatalogOpenIndices
(
Num_pg_attr_indices
,
Name_pg_attr_indices
,
irelations
);
CatalogOpenIndices
(
Num_pg_attr_indices
,
Name_pg_attr_indices
,
irelations
);
...
@@ -248,7 +248,7 @@ renamerel(char *oldrelname, char *newrelname)
...
@@ -248,7 +248,7 @@ renamerel(char *oldrelname, char *newrelname)
/* insert fixed rel tuple */
/* insert fixed rel tuple */
relrelation
=
heap_openr
(
RelationRelationName
);
relrelation
=
heap_openr
(
RelationRelationName
);
heap_replace
(
relrelation
,
&
oldreltup
->
t_
ctid
,
oldreltup
);
heap_replace
(
relrelation
,
&
oldreltup
->
t_
self
,
oldreltup
);
/* keep the system catalog indices current */
/* keep the system catalog indices current */
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
irelations
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
irelations
);
...
...
src/backend/commands/sequence.c
View file @
6beba218
...
@@ -368,7 +368,7 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
...
@@ -368,7 +368,7 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
ItemPointerData
iptr
;
ItemPointerData
iptr
;
PageHeader
page
;
PageHeader
page
;
ItemId
lp
;
ItemId
lp
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
sequence_magic
*
sm
;
sequence_magic
*
sm
;
Form_pg_sequence
seq
;
Form_pg_sequence
seq
;
...
@@ -391,9 +391,9 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
...
@@ -391,9 +391,9 @@ read_info(char *caller, SeqTable elm, Buffer *buf)
lp
=
PageGetItemId
(
page
,
FirstOffsetNumber
);
lp
=
PageGetItemId
(
page
,
FirstOffsetNumber
);
Assert
(
ItemIdIsUsed
(
lp
));
Assert
(
ItemIdIsUsed
(
lp
));
tuple
=
(
HeapTuple
)
PageGetItem
((
Page
)
page
,
lp
);
tuple
.
t_data
=
(
HeapTupleHeader
)
PageGetItem
((
Page
)
page
,
lp
);
seq
=
(
Form_pg_sequence
)
GETSTRUCT
(
tuple
);
seq
=
(
Form_pg_sequence
)
GETSTRUCT
(
&
tuple
);
elm
->
increment
=
seq
->
increment_by
;
elm
->
increment
=
seq
->
increment_by
;
...
...
src/backend/commands/trigger.c
View file @
6beba218
...
@@ -159,7 +159,7 @@ CreateTrigger(CreateTrigStmt *stmt)
...
@@ -159,7 +159,7 @@ CreateTrigger(CreateTrigStmt *stmt)
values
[
Anum_pg_trigger_tgrelid
-
1
]
=
ObjectIdGetDatum
(
RelationGetRelid
(
rel
));
values
[
Anum_pg_trigger_tgrelid
-
1
]
=
ObjectIdGetDatum
(
RelationGetRelid
(
rel
));
values
[
Anum_pg_trigger_tgname
-
1
]
=
NameGetDatum
(
namein
(
stmt
->
trigname
));
values
[
Anum_pg_trigger_tgname
-
1
]
=
NameGetDatum
(
namein
(
stmt
->
trigname
));
values
[
Anum_pg_trigger_tgfoid
-
1
]
=
ObjectIdGetDatum
(
tuple
->
t_oid
);
values
[
Anum_pg_trigger_tgfoid
-
1
]
=
ObjectIdGetDatum
(
tuple
->
t_
data
->
t_
oid
);
values
[
Anum_pg_trigger_tgtype
-
1
]
=
Int16GetDatum
(
tgtype
);
values
[
Anum_pg_trigger_tgtype
-
1
]
=
Int16GetDatum
(
tgtype
);
if
(
stmt
->
args
)
if
(
stmt
->
args
)
{
{
...
@@ -227,7 +227,7 @@ CreateTrigger(CreateTrigStmt *stmt)
...
@@ -227,7 +227,7 @@ CreateTrigger(CreateTrigStmt *stmt)
pgrel
=
heap_openr
(
RelationRelationName
);
pgrel
=
heap_openr
(
RelationRelationName
);
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
reltriggers
=
found
+
1
;
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
reltriggers
=
found
+
1
;
RelationInvalidateHeapTuple
(
pgrel
,
tuple
);
RelationInvalidateHeapTuple
(
pgrel
,
tuple
);
heap_replace
(
pgrel
,
&
tuple
->
t_
ctid
,
tuple
);
heap_replace
(
pgrel
,
&
tuple
->
t_
self
,
tuple
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
CatalogIndexInsert
(
ridescs
,
Num_pg_class_indices
,
pgrel
,
tuple
);
CatalogIndexInsert
(
ridescs
,
Num_pg_class_indices
,
pgrel
,
tuple
);
CatalogCloseIndices
(
Num_pg_class_indices
,
ridescs
);
CatalogCloseIndices
(
Num_pg_class_indices
,
ridescs
);
...
@@ -280,7 +280,7 @@ DropTrigger(DropTrigStmt *stmt)
...
@@ -280,7 +280,7 @@ DropTrigger(DropTrigStmt *stmt)
if
(
namestrcmp
(
&
(
pg_trigger
->
tgname
),
stmt
->
trigname
)
==
0
)
if
(
namestrcmp
(
&
(
pg_trigger
->
tgname
),
stmt
->
trigname
)
==
0
)
{
{
heap_delete
(
tgrel
,
&
tuple
->
t_
ctid
);
heap_delete
(
tgrel
,
&
tuple
->
t_
self
);
tgfound
++
;
tgfound
++
;
}
}
else
else
...
@@ -306,7 +306,7 @@ DropTrigger(DropTrigStmt *stmt)
...
@@ -306,7 +306,7 @@ DropTrigger(DropTrigStmt *stmt)
pgrel
=
heap_openr
(
RelationRelationName
);
pgrel
=
heap_openr
(
RelationRelationName
);
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
reltriggers
=
found
;
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
reltriggers
=
found
;
RelationInvalidateHeapTuple
(
pgrel
,
tuple
);
RelationInvalidateHeapTuple
(
pgrel
,
tuple
);
heap_replace
(
pgrel
,
&
tuple
->
t_
ctid
,
tuple
);
heap_replace
(
pgrel
,
&
tuple
->
t_
self
,
tuple
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
ridescs
);
CatalogIndexInsert
(
ridescs
,
Num_pg_class_indices
,
pgrel
,
tuple
);
CatalogIndexInsert
(
ridescs
,
Num_pg_class_indices
,
pgrel
,
tuple
);
CatalogCloseIndices
(
Num_pg_class_indices
,
ridescs
);
CatalogCloseIndices
(
Num_pg_class_indices
,
ridescs
);
...
@@ -340,7 +340,7 @@ RelationRemoveTriggers(Relation rel)
...
@@ -340,7 +340,7 @@ RelationRemoveTriggers(Relation rel)
tgscan
=
heap_beginscan
(
tgrel
,
0
,
SnapshotNow
,
1
,
&
key
);
tgscan
=
heap_beginscan
(
tgrel
,
0
,
SnapshotNow
,
1
,
&
key
);
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
tgscan
,
0
)))
while
(
HeapTupleIsValid
(
tup
=
heap_getnext
(
tgscan
,
0
)))
heap_delete
(
tgrel
,
&
tup
->
t_
ctid
);
heap_delete
(
tgrel
,
&
tup
->
t_
self
);
heap_endscan
(
tgscan
);
heap_endscan
(
tgscan
);
RelationUnsetLockForWrite
(
tgrel
);
RelationUnsetLockForWrite
(
tgrel
);
...
@@ -359,11 +359,10 @@ RelationBuildTriggers(Relation relation)
...
@@ -359,11 +359,10 @@ RelationBuildTriggers(Relation relation)
Form_pg_trigger
pg_trigger
;
Form_pg_trigger
pg_trigger
;
Relation
irel
;
Relation
irel
;
ScanKeyData
skey
;
ScanKeyData
skey
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
IndexScanDesc
sd
;
IndexScanDesc
sd
;
RetrieveIndexResult
indexRes
;
RetrieveIndexResult
indexRes
;
Buffer
buffer
;
Buffer
buffer
;
ItemPointer
iptr
;
struct
varlena
*
val
;
struct
varlena
*
val
;
bool
isnull
;
bool
isnull
;
int
found
;
int
found
;
...
@@ -387,16 +386,16 @@ RelationBuildTriggers(Relation relation)
...
@@ -387,16 +386,16 @@ RelationBuildTriggers(Relation relation)
if
(
!
indexRes
)
if
(
!
indexRes
)
break
;
break
;
iptr
=
&
indexRes
->
heap_iptr
;
tuple
.
t_self
=
indexRes
->
heap_iptr
;
tuple
=
heap_fetch
(
tgrel
,
SnapshotNow
,
iptr
,
&
buffer
);
heap_fetch
(
tgrel
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
!
HeapTupleIsValid
(
tuple
)
)
if
(
!
tuple
.
t_data
)
continue
;
continue
;
if
(
found
==
ntrigs
)
if
(
found
==
ntrigs
)
elog
(
ERROR
,
"RelationBuildTriggers: unexpected record found for rel %.*s"
,
elog
(
ERROR
,
"RelationBuildTriggers: unexpected record found for rel %.*s"
,
NAMEDATALEN
,
relation
->
rd_rel
->
relname
.
data
);
NAMEDATALEN
,
relation
->
rd_rel
->
relname
.
data
);
pg_trigger
=
(
Form_pg_trigger
)
GETSTRUCT
(
tuple
);
pg_trigger
=
(
Form_pg_trigger
)
GETSTRUCT
(
&
tuple
);
if
(
triggers
==
NULL
)
if
(
triggers
==
NULL
)
triggers
=
(
Trigger
*
)
palloc
(
sizeof
(
Trigger
));
triggers
=
(
Trigger
*
)
palloc
(
sizeof
(
Trigger
));
...
@@ -410,7 +409,7 @@ RelationBuildTriggers(Relation relation)
...
@@ -410,7 +409,7 @@ RelationBuildTriggers(Relation relation)
build
->
tgtype
=
pg_trigger
->
tgtype
;
build
->
tgtype
=
pg_trigger
->
tgtype
;
build
->
tgnargs
=
pg_trigger
->
tgnargs
;
build
->
tgnargs
=
pg_trigger
->
tgnargs
;
memcpy
(
build
->
tgattr
,
&
(
pg_trigger
->
tgattr
),
8
*
sizeof
(
int16
));
memcpy
(
build
->
tgattr
,
&
(
pg_trigger
->
tgattr
),
8
*
sizeof
(
int16
));
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_trigger_tgargs
,
Anum_pg_trigger_tgargs
,
tgrel
->
rd_att
,
&
isnull
);
tgrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
@@ -421,7 +420,7 @@ RelationBuildTriggers(Relation relation)
...
@@ -421,7 +420,7 @@ RelationBuildTriggers(Relation relation)
char
*
p
;
char
*
p
;
int
i
;
int
i
;
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_trigger_tgargs
,
Anum_pg_trigger_tgargs
,
tgrel
->
rd_att
,
&
isnull
);
tgrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
@@ -793,7 +792,8 @@ static HeapTuple
...
@@ -793,7 +792,8 @@ static HeapTuple
GetTupleForTrigger
(
Relation
relation
,
ItemPointer
tid
,
bool
before
)
GetTupleForTrigger
(
Relation
relation
,
ItemPointer
tid
,
bool
before
)
{
{
ItemId
lp
;
ItemId
lp
;
HeapTuple
tuple
;
HeapTupleData
tuple
;
HeapTuple
result
;
PageHeader
dp
;
PageHeader
dp
;
Buffer
b
;
Buffer
b
;
...
@@ -807,28 +807,30 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
...
@@ -807,28 +807,30 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
Assert
(
ItemIdIsUsed
(
lp
));
Assert
(
ItemIdIsUsed
(
lp
));
tuple
=
(
HeapTuple
)
PageGetItem
((
Page
)
dp
,
lp
);
tuple
.
t_data
=
(
HeapTupleHeader
)
PageGetItem
((
Page
)
dp
,
lp
);
tuple
.
t_len
=
ItemIdGetLength
(
lp
);
tuple
.
t_self
=
*
tid
;
if
(
before
)
if
(
before
)
{
{
if
(
TupleUpdatedByCurXactAndCmd
(
tuple
))
if
(
TupleUpdatedByCurXactAndCmd
(
&
tuple
))
{
{
elog
(
NOTICE
,
"GetTupleForTrigger: Non-functional delete/update"
);
elog
(
NOTICE
,
"GetTupleForTrigger: Non-functional delete/update"
);
ReleaseBuffer
(
b
);
ReleaseBuffer
(
b
);
return
NULL
;
return
NULL
;
}
}
HeapTupleSatisfies
(
lp
,
relation
,
b
,
dp
,
HeapTupleSatisfies
(
&
tuple
,
relation
,
b
,
dp
,
false
,
0
,
(
ScanKey
)
NULL
,
tuple
);
false
,
0
,
(
ScanKey
)
NULL
);
if
(
!
tuple
)
if
(
!
tuple
.
t_data
)
{
{
ReleaseBuffer
(
b
);
ReleaseBuffer
(
b
);
elog
(
ERROR
,
"GetTupleForTrigger: (am)invalid tid"
);
elog
(
ERROR
,
"GetTupleForTrigger: (am)invalid tid"
);
}
}
}
}
tuple
=
heap_copytuple
(
tuple
);
result
=
heap_copytuple
(
&
tuple
);
ReleaseBuffer
(
b
);
ReleaseBuffer
(
b
);
return
tuple
;
return
result
;
}
}
src/backend/commands/vacuum.c
View file @
6beba218
This diff is collapsed.
Click to expand it.
src/backend/executor/execMain.c
View file @
6beba218
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
8 1998/10/14 05:10:00 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.5
9 1998/11/27 19:51:59 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -963,16 +963,7 @@ ExecAppend(TupleTableSlot *slot,
...
@@ -963,16 +963,7 @@ ExecAppend(TupleTableSlot *slot,
if
(
resultRelationDesc
->
rd_att
->
constr
)
if
(
resultRelationDesc
->
rd_att
->
constr
)
{
{
HeapTuple
newtuple
;
ExecConstraints
(
"ExecAppend"
,
resultRelationDesc
,
tuple
);
newtuple
=
ExecConstraints
(
"ExecAppend"
,
resultRelationDesc
,
tuple
);
if
(
newtuple
!=
tuple
)
/* modified by DEFAULT */
{
Assert
(
slot
->
ttc_shouldFree
);
pfree
(
tuple
);
slot
->
val
=
tuple
=
newtuple
;
}
}
}
/******************
/******************
...
@@ -993,7 +984,7 @@ ExecAppend(TupleTableSlot *slot,
...
@@ -993,7 +984,7 @@ ExecAppend(TupleTableSlot *slot,
*/
*/
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
if
(
numIndices
>
0
)
if
(
numIndices
>
0
)
ExecInsertIndexTuples
(
slot
,
&
(
tuple
->
t_
ctid
),
estate
,
false
);
ExecInsertIndexTuples
(
slot
,
&
(
tuple
->
t_
self
),
estate
,
false
);
(
estate
->
es_processed
)
++
;
(
estate
->
es_processed
)
++
;
estate
->
es_lastoid
=
newId
;
estate
->
es_lastoid
=
newId
;
...
@@ -1146,16 +1137,7 @@ ExecReplace(TupleTableSlot *slot,
...
@@ -1146,16 +1137,7 @@ ExecReplace(TupleTableSlot *slot,
if
(
resultRelationDesc
->
rd_att
->
constr
)
if
(
resultRelationDesc
->
rd_att
->
constr
)
{
{
HeapTuple
newtuple
;
ExecConstraints
(
"ExecReplace"
,
resultRelationDesc
,
tuple
);
newtuple
=
ExecConstraints
(
"ExecReplace"
,
resultRelationDesc
,
tuple
);
if
(
newtuple
!=
tuple
)
/* modified by DEFAULT */
{
Assert
(
slot
->
ttc_shouldFree
);
pfree
(
tuple
);
slot
->
val
=
tuple
=
newtuple
;
}
}
}
/******************
/******************
...
@@ -1200,7 +1182,7 @@ ExecReplace(TupleTableSlot *slot,
...
@@ -1200,7 +1182,7 @@ ExecReplace(TupleTableSlot *slot,
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
numIndices
=
resultRelationInfo
->
ri_NumIndices
;
if
(
numIndices
>
0
)
if
(
numIndices
>
0
)
ExecInsertIndexTuples
(
slot
,
&
(
tuple
->
t_
ctid
),
estate
,
true
);
ExecInsertIndexTuples
(
slot
,
&
(
tuple
->
t_
self
),
estate
,
true
);
/* AFTER ROW UPDATE Triggers */
/* AFTER ROW UPDATE Triggers */
if
(
resultRelationDesc
->
trigdesc
&&
if
(
resultRelationDesc
->
trigdesc
&&
...
@@ -1334,18 +1316,12 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
...
@@ -1334,18 +1316,12 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
}
}
HeapTuple
void
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
)
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
)
{
{
HeapTuple
newtuple
=
tuple
;
Assert
(
rel
->
rd_att
->
constr
);
Assert
(
rel
->
rd_att
->
constr
);
#if 0
if (rel->rd_att->constr->num_defval > 0)
newtuple = tuple = ExecAttrDefault(rel, tuple);
#endif
if
(
rel
->
rd_att
->
constr
->
has_not_null
)
if
(
rel
->
rd_att
->
constr
->
has_not_null
)
{
{
int
attrChk
;
int
attrChk
;
...
@@ -1366,5 +1342,5 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
...
@@ -1366,5 +1342,5 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
elog
(
ERROR
,
"%s: rejected due to CHECK constraint %s"
,
caller
,
failed
);
elog
(
ERROR
,
"%s: rejected due to CHECK constraint %s"
,
caller
,
failed
);
}
}
return
newtuple
;
return
;
}
}
src/backend/executor/execQual.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.3
7 1998/09/25 13:38:31 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.3
8 1998/11/27 19:52:00 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -287,7 +287,7 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
...
@@ -287,7 +287,7 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
tempSlot
->
ttc_buffer
=
InvalidBuffer
;
tempSlot
->
ttc_buffer
=
InvalidBuffer
;
tempSlot
->
ttc_whichplan
=
-
1
;
tempSlot
->
ttc_whichplan
=
-
1
;
tup
=
heap_copytuple
(
slot
->
val
);
tup
=
heap_copytuple
(
heapTuple
);
td
=
CreateTupleDescCopy
(
slot
->
ttc_tupleDescriptor
);
td
=
CreateTupleDescCopy
(
slot
->
ttc_tupleDescriptor
);
ExecSetSlotDescriptor
(
tempSlot
,
td
);
ExecSetSlotDescriptor
(
tempSlot
,
td
);
...
@@ -549,7 +549,6 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
...
@@ -549,7 +549,6 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
{
{
AttrNumber
attrno
;
AttrNumber
attrno
;
TupleDesc
tupdesc
;
TupleDesc
tupdesc
;
HeapTuple
tuple
;
Datum
retval
;
Datum
retval
;
int
natts
;
int
natts
;
int
i
;
int
i
;
...
@@ -567,9 +566,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
...
@@ -567,9 +566,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
}
}
tupdesc
=
slot
->
ttc_tupleDescriptor
;
tupdesc
=
slot
->
ttc_tupleDescriptor
;
tuple
=
slot
->
val
;
natts
=
slot
->
val
->
t_data
->
t_natts
;
natts
=
tuple
->
t_natts
;
attrno
=
InvalidAttrNumber
;
attrno
=
InvalidAttrNumber
;
for
(
i
=
0
;
i
<
tupdesc
->
natts
;
i
++
)
for
(
i
=
0
;
i
<
tupdesc
->
natts
;
i
++
)
...
...
src/backend/executor/execUtils.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.
39 1998/09/23 04:22:06 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.
40 1998/11/27 19:52:01 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1138,7 +1138,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
...
@@ -1138,7 +1138,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
result
=
index_insert
(
relationDescs
[
i
],
/* index relation */
result
=
index_insert
(
relationDescs
[
i
],
/* index relation */
datum
,
/* array of heaptuple Datums */
datum
,
/* array of heaptuple Datums */
nulls
,
/* info on nulls */
nulls
,
/* info on nulls */
&
(
heapTuple
->
t_
ctid
),
/* o
id of heap tuple */
&
(
heapTuple
->
t_
self
),
/* t
id of heap tuple */
heapRelation
);
heapRelation
);
/* ----------------
/* ----------------
...
...
src/backend/executor/functions.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.2
0 1998/09/01 04:28:23 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.2
1 1998/11/27 19:52:01 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -270,7 +270,7 @@ copy_function_result(FunctionCachePtr fcache,
...
@@ -270,7 +270,7 @@ copy_function_result(FunctionCachePtr fcache,
int
i
=
0
;
int
i
=
0
;
TupleDesc
funcTd
=
funcSlot
->
ttc_tupleDescriptor
;
TupleDesc
funcTd
=
funcSlot
->
ttc_tupleDescriptor
;
while
(
i
<
oldTuple
->
t_natts
)
while
(
i
<
oldTuple
->
t_
data
->
t_
natts
)
{
{
funcTd
->
attrs
[
i
]
=
funcTd
->
attrs
[
i
]
=
(
Form_pg_attribute
)
palloc
(
ATTRIBUTE_TUPLE_SIZE
);
(
Form_pg_attribute
)
palloc
(
ATTRIBUTE_TUPLE_SIZE
);
...
@@ -341,13 +341,11 @@ postquel_execute(execution_state *es,
...
@@ -341,13 +341,11 @@ postquel_execute(execution_state *es,
resSlot
=
copy_function_result
(
fcache
,
slot
);
resSlot
=
copy_function_result
(
fcache
,
slot
);
if
(
fTlist
!=
NIL
)
if
(
fTlist
!=
NIL
)
{
{
HeapTuple
tup
;
TargetEntry
*
tle
=
lfirst
(
fTlist
);
TargetEntry
*
tle
=
lfirst
(
fTlist
);
tup
=
resSlot
->
val
;
value
=
ProjectAttribute
(
resSlot
->
ttc_tupleDescriptor
,
value
=
ProjectAttribute
(
resSlot
->
ttc_tupleDescriptor
,
tle
,
tle
,
tup
,
resSlot
->
val
,
isNull
);
isNull
);
}
}
else
else
...
...
src/backend/executor/nodeAgg.c
View file @
6beba218
...
@@ -248,16 +248,12 @@ ExecAgg(Agg *node)
...
@@ -248,16 +248,12 @@ ExecAgg(Agg *node)
*/
*/
for
(;;)
for
(;;)
{
{
HeapTuple
outerTuple
=
NULL
;
TupleTableSlot
*
outerslot
;
TupleTableSlot
*
outerslot
;
isNull
=
isNull1
=
isNull2
=
0
;
isNull
=
isNull1
=
isNull2
=
0
;
outerslot
=
ExecProcNode
(
outerPlan
,
(
Plan
*
)
node
);
outerslot
=
ExecProcNode
(
outerPlan
,
(
Plan
*
)
node
);
if
(
outerslot
)
if
(
TupIsNull
(
outerslot
))
outerTuple
=
outerslot
->
val
;
if
(
!
HeapTupleIsValid
(
outerTuple
))
{
{
/*
/*
* when the outerplan doesn't return a single tuple,
* when the outerplan doesn't return a single tuple,
* create a dummy heaptuple anyway because we still need
* create a dummy heaptuple anyway because we still need
...
@@ -666,7 +662,7 @@ aggGetAttr(TupleTableSlot *slot,
...
@@ -666,7 +662,7 @@ aggGetAttr(TupleTableSlot *slot,
tempSlot
->
ttc_buffer
=
InvalidBuffer
;
tempSlot
->
ttc_buffer
=
InvalidBuffer
;
tempSlot
->
ttc_whichplan
=
-
1
;
tempSlot
->
ttc_whichplan
=
-
1
;
tup
=
heap_copytuple
(
slot
->
val
);
tup
=
heap_copytuple
(
heapTuple
);
td
=
CreateTupleDescCopy
(
slot
->
ttc_tupleDescriptor
);
td
=
CreateTupleDescCopy
(
slot
->
ttc_tupleDescriptor
);
ExecSetSlotDescriptor
(
tempSlot
,
td
);
ExecSetSlotDescriptor
(
tempSlot
,
td
);
...
...
src/backend/executor/nodeGroup.c
View file @
6beba218
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
* columns. (ie. tuples from the same group are consecutive)
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.2
2 1998/09/01 04:28:28 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.2
3 1998/11/27 19:52:01 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -102,13 +102,12 @@ ExecGroupEveryTuple(Group *node)
...
@@ -102,13 +102,12 @@ ExecGroupEveryTuple(Group *node)
else
else
{
{
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
if
(
outerslot
)
if
(
TupIsNull
(
outerslot
))
outerTuple
=
outerslot
->
val
;
if
(
!
HeapTupleIsValid
(
outerTuple
))
{
{
grpstate
->
grp_done
=
TRUE
;
grpstate
->
grp_done
=
TRUE
;
return
NULL
;
return
NULL
;
}
}
outerTuple
=
outerslot
->
val
;
firsttuple
=
grpstate
->
grp_firstTuple
;
firsttuple
=
grpstate
->
grp_firstTuple
;
/* this should occur on the first call only */
/* this should occur on the first call only */
...
@@ -121,7 +120,7 @@ ExecGroupEveryTuple(Group *node)
...
@@ -121,7 +120,7 @@ ExecGroupEveryTuple(Group *node)
* Compare with first tuple and see if this tuple is of the
* Compare with first tuple and see if this tuple is of the
* same group.
* same group.
*/
*/
if
(
!
sameGroup
(
firsttuple
,
outer
slot
->
val
,
if
(
!
sameGroup
(
firsttuple
,
outer
Tuple
,
node
->
numCols
,
node
->
grpColIdx
,
node
->
numCols
,
node
->
grpColIdx
,
ExecGetScanType
(
&
grpstate
->
csstate
)))
ExecGetScanType
(
&
grpstate
->
csstate
)))
{
{
...
@@ -189,14 +188,13 @@ ExecGroupOneTuple(Group *node)
...
@@ -189,14 +188,13 @@ ExecGroupOneTuple(Group *node)
if
(
firsttuple
==
NULL
)
if
(
firsttuple
==
NULL
)
{
{
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
if
(
outerslot
)
if
(
TupIsNull
(
outerslot
))
outerTuple
=
outerslot
->
val
;
if
(
!
HeapTupleIsValid
(
outerTuple
))
{
{
grpstate
->
grp_done
=
TRUE
;
grpstate
->
grp_done
=
TRUE
;
return
NULL
;
return
NULL
;
}
}
grpstate
->
grp_firstTuple
=
firsttuple
=
heap_copytuple
(
outerTuple
);
grpstate
->
grp_firstTuple
=
firsttuple
=
heap_copytuple
(
outerslot
->
val
);
}
}
/*
/*
...
@@ -205,19 +203,20 @@ ExecGroupOneTuple(Group *node)
...
@@ -205,19 +203,20 @@ ExecGroupOneTuple(Group *node)
for
(;;)
for
(;;)
{
{
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
outerslot
=
ExecProcNode
(
outerPlan
(
node
),
(
Plan
*
)
node
);
outerTuple
=
(
outerslot
)
?
outerslot
->
val
:
NULL
;
if
(
TupIsNull
(
outerslot
))
if
(
!
HeapTupleIsValid
(
outerTuple
))
{
{
grpstate
->
grp_done
=
TRUE
;
grpstate
->
grp_done
=
TRUE
;
outerTuple
=
NULL
;
break
;
break
;
}
}
outerTuple
=
outerslot
->
val
;
/* ----------------
/* ----------------
* Compare with first tuple and see if this tuple is of
* Compare with first tuple and see if this tuple is of
* the same group.
* the same group.
* ----------------
* ----------------
*/
*/
if
((
!
sameGroup
(
firsttuple
,
outer
slot
->
val
,
if
((
!
sameGroup
(
firsttuple
,
outer
Tuple
,
node
->
numCols
,
node
->
grpColIdx
,
node
->
numCols
,
node
->
grpColIdx
,
ExecGetScanType
(
&
grpstate
->
csstate
))))
ExecGetScanType
(
&
grpstate
->
csstate
))))
break
;
break
;
...
...
src/backend/executor/nodeHash.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.2
3 1998/09/01 04:28:29 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.2
4 1998/11/27 19:52:02 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -489,16 +489,19 @@ ExecHashTableInsert(HashJoinTable hashtable,
...
@@ -489,16 +489,19 @@ ExecHashTableInsert(HashJoinTable hashtable,
*/
*/
bucket
=
(
HashBucket
)
bucket
=
(
HashBucket
)
(
ABSADDR
(
hashtable
->
top
)
+
bucketno
*
hashtable
->
bucketsize
);
(
ABSADDR
(
hashtable
->
top
)
+
bucketno
*
hashtable
->
bucketsize
);
if
((
char
*
)
LONGALIGN
(
ABSADDR
(
bucket
->
bottom
))
if
((
char
*
)
LONGALIGN
(
ABSADDR
(
bucket
->
bottom
))
-
(
char
*
)
bucket
-
(
char
*
)
bucket
+
heapTuple
->
t_len
>
hashtable
->
bucketsize
)
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
>
hashtable
->
bucketsize
)
ExecHashOverflowInsert
(
hashtable
,
bucket
,
heapTuple
);
ExecHashOverflowInsert
(
hashtable
,
bucket
,
heapTuple
);
else
else
{
{
memmove
((
char
*
)
LONGALIGN
(
ABSADDR
(
bucket
->
bottom
)),
memmove
((
char
*
)
LONGALIGN
(
ABSADDR
(
bucket
->
bottom
)),
heapTuple
,
heapTuple
,
HEAPTUPLESIZE
);
memmove
((
char
*
)
LONGALIGN
(
ABSADDR
(
bucket
->
bottom
))
+
HEAPTUPLESIZE
,
heapTuple
->
t_data
,
heapTuple
->
t_len
);
heapTuple
->
t_len
);
bucket
->
bottom
=
bucket
->
bottom
=
((
RelativeAddr
)
LONGALIGN
(
bucket
->
bottom
)
+
((
RelativeAddr
)
LONGALIGN
(
bucket
->
bottom
)
+
heapTuple
->
t_len
);
heapTuple
->
t_len
+
HEAPTUPLESIZE
);
}
}
}
}
else
else
...
@@ -611,7 +614,7 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
...
@@ -611,7 +614,7 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
* ----------------
* ----------------
*/
*/
newend
=
(
RelativeAddr
)
LONGALIGN
(
hashtable
->
overflownext
+
sizeof
(
*
otuple
)
newend
=
(
RelativeAddr
)
LONGALIGN
(
hashtable
->
overflownext
+
sizeof
(
*
otuple
)
+
heapTuple
->
t_len
);
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
);
if
(
newend
>
hashtable
->
bottom
)
if
(
newend
>
hashtable
->
bottom
)
{
{
#if 0
#if 0
...
@@ -664,6 +667,9 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
...
@@ -664,6 +667,9 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
otuple
->
tuple
=
RELADDR
(
LONGALIGN
(((
char
*
)
otuple
+
sizeof
(
*
otuple
))));
otuple
->
tuple
=
RELADDR
(
LONGALIGN
(((
char
*
)
otuple
+
sizeof
(
*
otuple
))));
memmove
(
ABSADDR
(
otuple
->
tuple
),
memmove
(
ABSADDR
(
otuple
->
tuple
),
heapTuple
,
heapTuple
,
HEAPTUPLESIZE
);
memmove
(
ABSADDR
(
otuple
->
tuple
)
+
HEAPTUPLESIZE
,
heapTuple
->
t_data
,
heapTuple
->
t_len
);
heapTuple
->
t_len
);
}
}
...
@@ -704,7 +710,10 @@ ExecScanHashBucket(HashJoinState *hjstate,
...
@@ -704,7 +710,10 @@ ExecScanHashBucket(HashJoinState *hjstate,
LONGALIGN
(
ABSADDR
(
bucket
->
top
));
LONGALIGN
(
ABSADDR
(
bucket
->
top
));
else
else
heapTuple
=
(
HeapTuple
)
heapTuple
=
(
HeapTuple
)
LONGALIGN
(((
char
*
)
curtuple
+
curtuple
->
t_len
));
LONGALIGN
(((
char
*
)
curtuple
+
curtuple
->
t_len
+
HEAPTUPLESIZE
));
heapTuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
heapTuple
+
HEAPTUPLESIZE
);
while
(
heapTuple
<
(
HeapTuple
)
ABSADDR
(
bucket
->
bottom
))
while
(
heapTuple
<
(
HeapTuple
)
ABSADDR
(
bucket
->
bottom
))
{
{
...
@@ -721,7 +730,9 @@ ExecScanHashBucket(HashJoinState *hjstate,
...
@@ -721,7 +730,9 @@ ExecScanHashBucket(HashJoinState *hjstate,
return
heapTuple
;
return
heapTuple
;
heapTuple
=
(
HeapTuple
)
heapTuple
=
(
HeapTuple
)
LONGALIGN
(((
char
*
)
heapTuple
+
heapTuple
->
t_len
));
LONGALIGN
(((
char
*
)
heapTuple
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
));
heapTuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
heapTuple
+
HEAPTUPLESIZE
);
}
}
if
(
firstotuple
==
NULL
)
if
(
firstotuple
==
NULL
)
...
@@ -742,6 +753,8 @@ ExecScanHashBucket(HashJoinState *hjstate,
...
@@ -742,6 +753,8 @@ ExecScanHashBucket(HashJoinState *hjstate,
while
(
otuple
!=
NULL
)
while
(
otuple
!=
NULL
)
{
{
heapTuple
=
(
HeapTuple
)
ABSADDR
(
otuple
->
tuple
);
heapTuple
=
(
HeapTuple
)
ABSADDR
(
otuple
->
tuple
);
heapTuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
heapTuple
+
HEAPTUPLESIZE
);
inntuple
=
ExecStoreTuple
(
heapTuple
,
/* tuple to store */
inntuple
=
ExecStoreTuple
(
heapTuple
,
/* tuple to store */
hjstate
->
hj_HashTupleSlot
,
/* slot */
hjstate
->
hj_HashTupleSlot
,
/* slot */
...
...
src/backend/executor/nodeHashjoin.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.1
3 1998/09/01 04:28:31 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.1
4 1998/11/27 19:52:02 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -646,7 +646,10 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
...
@@ -646,7 +646,10 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
(
*
position
)
=
bufstart
;
(
*
position
)
=
bufstart
;
}
}
heapTuple
=
(
HeapTuple
)
(
*
position
);
heapTuple
=
(
HeapTuple
)
(
*
position
);
(
*
position
)
=
(
char
*
)
LONGALIGN
(
*
position
+
heapTuple
->
t_len
);
heapTuple
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
heapTuple
+
HEAPTUPLESIZE
);
(
*
position
)
=
(
char
*
)
LONGALIGN
(
*
position
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
);
return
ExecStoreTuple
(
heapTuple
,
tupleSlot
,
InvalidBuffer
,
false
);
return
ExecStoreTuple
(
heapTuple
,
tupleSlot
,
InvalidBuffer
,
false
);
}
}
...
@@ -824,7 +827,7 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
...
@@ -824,7 +827,7 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
if
(
position
==
NULL
)
if
(
position
==
NULL
)
position
=
pagestart
;
position
=
pagestart
;
if
(
position
+
heapTuple
->
t_len
>=
pagebound
)
if
(
position
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
>=
pagebound
)
{
{
cc
=
FileSeek
(
file
,
0L
,
SEEK_END
);
cc
=
FileSeek
(
file
,
0L
,
SEEK_END
);
if
(
cc
<
0
)
if
(
cc
<
0
)
...
@@ -836,8 +839,9 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
...
@@ -836,8 +839,9 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
position
=
pagestart
;
position
=
pagestart
;
*
pageend
=
0
;
*
pageend
=
0
;
}
}
memmove
(
position
,
heapTuple
,
heapTuple
->
t_len
);
memmove
(
position
,
heapTuple
,
HEAPTUPLESIZE
);
position
=
(
char
*
)
LONGALIGN
(
position
+
heapTuple
->
t_len
);
memmove
(
position
+
HEAPTUPLESIZE
,
heapTuple
->
t_data
,
heapTuple
->
t_len
);
position
=
(
char
*
)
LONGALIGN
(
position
+
heapTuple
->
t_len
+
HEAPTUPLESIZE
);
*
pageend
=
position
-
buffer
;
*
pageend
=
position
-
buffer
;
return
position
;
return
position
;
...
...
src/backend/executor/nodeIndexscan.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.2
8 1998/11/22 10:48:36
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.2
9 1998/11/27 19:52:03
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -109,6 +109,7 @@ IndexNext(IndexScan *node)
...
@@ -109,6 +109,7 @@ IndexNext(IndexScan *node)
heapRelation
=
scanstate
->
css_currentRelation
;
heapRelation
=
scanstate
->
css_currentRelation
;
numIndices
=
indexstate
->
iss_NumIndices
;
numIndices
=
indexstate
->
iss_NumIndices
;
slot
=
scanstate
->
css_ScanTupleSlot
;
slot
=
scanstate
->
css_ScanTupleSlot
;
tuple
=
&
(
indexstate
->
iss_htup
);
/* ----------------
/* ----------------
* ok, now that we have what we need, fetch an index tuple.
* ok, now that we have what we need, fetch an index tuple.
...
@@ -121,11 +122,11 @@ IndexNext(IndexScan *node)
...
@@ -121,11 +122,11 @@ IndexNext(IndexScan *node)
scandesc
=
scanDescs
[
indexstate
->
iss_IndexPtr
];
scandesc
=
scanDescs
[
indexstate
->
iss_IndexPtr
];
while
((
result
=
index_getnext
(
scandesc
,
direction
))
!=
NULL
)
while
((
result
=
index_getnext
(
scandesc
,
direction
))
!=
NULL
)
{
{
tuple
=
heap_fetch
(
heapRelation
,
snapshot
,
tuple
->
t_self
=
result
->
heap_iptr
;
&
result
->
heap_iptr
,
&
buffer
);
heap_fetch
(
heapRelation
,
snapshot
,
tuple
,
&
buffer
);
pfree
(
result
);
pfree
(
result
);
if
(
tuple
!=
NULL
)
if
(
tuple
->
t_data
!=
NULL
)
{
{
bool
prev_matches
=
false
;
bool
prev_matches
=
false
;
int
prev_index
;
int
prev_index
;
...
...
src/backend/executor/nodeMaterial.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.1
7 1998/09/01 04:28:34 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.1
8 1998/11/27 19:52:03 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -114,12 +114,21 @@ ExecMaterial(Material *node)
...
@@ -114,12 +114,21 @@ ExecMaterial(Material *node)
{
{
slot
=
ExecProcNode
(
outerNode
,
(
Plan
*
)
node
);
slot
=
ExecProcNode
(
outerNode
,
(
Plan
*
)
node
);
heapTuple
=
slot
->
val
;
if
(
TupIsNull
(
slot
))
if
(
heapTuple
==
NULL
)
break
;
break
;
heap_insert
(
tempRelation
,
/* relation desc */
/*
heapTuple
);
/* heap tuple to insert */
* heap_insert changes something...
*/
if
(
slot
->
ttc_buffer
!=
InvalidBuffer
)
heapTuple
=
heap_copytuple
(
slot
->
val
);
else
heapTuple
=
slot
->
val
;
heap_insert
(
tempRelation
,
heapTuple
);
if
(
slot
->
ttc_buffer
!=
InvalidBuffer
)
pfree
(
heapTuple
);
ExecClearTuple
(
slot
);
ExecClearTuple
(
slot
);
}
}
...
...
src/backend/executor/nodeTee.c
View file @
6beba218
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
* ExecEndTee
* ExecEndTee
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.2
4 1998/10/08 18:29:27 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.2
5 1998/11/27 19:52:03 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -342,11 +342,20 @@ ExecTee(Tee *node, Plan *parent)
...
@@ -342,11 +342,20 @@ ExecTee(Tee *node, Plan *parent)
slot
=
ExecProcNode
(
childNode
,
(
Plan
*
)
node
);
slot
=
ExecProcNode
(
childNode
,
(
Plan
*
)
node
);
if
(
!
TupIsNull
(
slot
))
if
(
!
TupIsNull
(
slot
))
{
{
/*
* heap_insert changes something...
*/
if
(
slot
->
ttc_buffer
!=
InvalidBuffer
)
heapTuple
=
heap_copytuple
(
slot
->
val
);
else
heapTuple
=
slot
->
val
;
heapTuple
=
slot
->
val
;
/* insert into temporary relation */
/* insert into temporary relation */
heap_insert
(
bufferRel
,
heapTuple
);
heap_insert
(
bufferRel
,
heapTuple
);
if
(
slot
->
ttc_buffer
!=
InvalidBuffer
)
pfree
(
heapTuple
);
/*
/*
* once there is data in the temporary relation, ensure that
* once there is data in the temporary relation, ensure that
* the left and right scandescs are initialized
* the left and right scandescs are initialized
...
...
src/backend/executor/nodeUnique.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.1
7 1998/02/26 04:31:34 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.1
8 1998/11/27 19:52:03 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -76,7 +76,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2)
...
@@ -76,7 +76,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2)
* THE t_len FIELDS CAN BE THE SAME IN THIS CASE!!
* THE t_len FIELDS CAN BE THE SAME IN THIS CASE!!
* ----------------
* ----------------
*/
*/
if
(
h1
->
t_
hoff
!=
h2
->
t_hoff
)
if
(
h1
->
t_
data
->
t_hoff
!=
h2
->
t_data
->
t_hoff
)
return
false
;
return
false
;
/* ----------------
/* ----------------
...
@@ -86,7 +86,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2)
...
@@ -86,7 +86,7 @@ ExecIdenticalTuples(TupleTableSlot *t1, TupleTableSlot *t2)
*/
*/
d1
=
(
char
*
)
GETSTRUCT
(
h1
);
d1
=
(
char
*
)
GETSTRUCT
(
h1
);
d2
=
(
char
*
)
GETSTRUCT
(
h2
);
d2
=
(
char
*
)
GETSTRUCT
(
h2
);
len
=
(
int
)
h1
->
t_len
-
(
int
)
h1
->
t_hoff
;
len
=
(
int
)
h1
->
t_len
-
(
int
)
h1
->
t_
data
->
t_
hoff
;
/* ----------------
/* ----------------
* byte compare the data areas and return the result.
* byte compare the data areas and return the result.
...
...
src/backend/executor/spi.c
View file @
6beba218
...
@@ -356,11 +356,12 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
...
@@ -356,11 +356,12 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
if
(
i
==
natts
)
/* no errors in *attnum */
if
(
i
==
natts
)
/* no errors in *attnum */
{
{
mtuple
=
heap_formtuple
(
rel
->
rd_att
,
v
,
n
);
mtuple
=
heap_formtuple
(
rel
->
rd_att
,
v
,
n
);
infomask
=
mtuple
->
t_infomask
;
infomask
=
mtuple
->
t_data
->
t_infomask
;
memmove
(
&
(
mtuple
->
t_ctid
),
&
(
tuple
->
t_ctid
),
memmove
(
&
(
mtuple
->
t_data
->
t_oid
),
&
(
tuple
->
t_data
->
t_oid
),
((
char
*
)
&
(
tuple
->
t_hoff
)
-
(
char
*
)
&
(
tuple
->
t_ctid
)));
((
char
*
)
&
(
tuple
->
t_data
->
t_hoff
)
-
mtuple
->
t_infomask
=
infomask
;
(
char
*
)
&
(
tuple
->
t_data
->
t_oid
)));
mtuple
->
t_natts
=
numberOfAttributes
;
mtuple
->
t_data
->
t_infomask
=
infomask
;
mtuple
->
t_data
->
t_natts
=
numberOfAttributes
;
}
}
else
else
{
{
...
@@ -413,7 +414,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
...
@@ -413,7 +414,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
Oid
foutoid
;
Oid
foutoid
;
SPI_result
=
0
;
SPI_result
=
0
;
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
if
(
tuple
->
t_
data
->
t_
natts
<
fnumber
||
fnumber
<=
0
)
{
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
return
NULL
;
return
NULL
;
...
@@ -441,7 +442,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
...
@@ -441,7 +442,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
*
isnull
=
true
;
*
isnull
=
true
;
SPI_result
=
0
;
SPI_result
=
0
;
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
if
(
tuple
->
t_
data
->
t_
natts
<
fnumber
||
fnumber
<=
0
)
{
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
return
(
Datum
)
NULL
;
return
(
Datum
)
NULL
;
...
...
src/backend/libpq/be-dumpdata.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.1
7 1998/09/01 03:22:43 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.1
8 1998/11/27 19:52:05 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -276,8 +276,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -276,8 +276,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
* Allocate space for a tuple.
* Allocate space for a tuple.
* ----------------
* ----------------
*/
*/
tuples
->
values
[
tuples
->
tuple_index
]
=
pbuf_addTuple
(
tuple
->
t_natts
);
tuples
->
values
[
tuples
->
tuple_index
]
=
pbuf_addTuple
(
tuple
->
t_
data
->
t_
natts
);
tuples
->
lengths
[
tuples
->
tuple_index
]
=
pbuf_addTupleValueLengths
(
tuple
->
t_natts
);
tuples
->
lengths
[
tuples
->
tuple_index
]
=
pbuf_addTupleValueLengths
(
tuple
->
t_
data
->
t_
natts
);
/* ----------------
/* ----------------
* copy printable representations of the tuple's attributes
* copy printable representations of the tuple's attributes
* to the portal.
* to the portal.
...
@@ -297,7 +297,7 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
...
@@ -297,7 +297,7 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
values
=
tuples
->
values
[
tuples
->
tuple_index
];
values
=
tuples
->
values
[
tuples
->
tuple_index
];
lengths
=
tuples
->
lengths
[
tuples
->
tuple_index
];
lengths
=
tuples
->
lengths
[
tuples
->
tuple_index
];
for
(
i
=
0
;
i
<
tuple
->
t_natts
;
i
++
)
for
(
i
=
0
;
i
<
tuple
->
t_
data
->
t_
natts
;
i
++
)
{
{
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
attr
=
heap_getattr
(
tuple
,
i
+
1
,
typeinfo
,
&
isnull
);
typoutput
=
typtoout
((
Oid
)
typeinfo
->
attrs
[
i
]
->
atttypid
);
typoutput
=
typtoout
((
Oid
)
typeinfo
->
attrs
[
i
]
->
atttypid
);
...
...
src/backend/optimizer/util/clauses.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.2
4 1998/09/01 04:30:02 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.2
5 1998/11/27 19:52:07 vadim
Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -773,7 +773,7 @@ CommuteClause(Node *clause)
...
@@ -773,7 +773,7 @@ CommuteClause(Node *clause)
commuTup
=
(
Form_pg_operator
)
GETSTRUCT
(
heapTup
);
commuTup
=
(
Form_pg_operator
)
GETSTRUCT
(
heapTup
);
commu
=
makeOper
(
heapTup
->
t_oid
,
commu
=
makeOper
(
heapTup
->
t_
data
->
t_
oid
,
InvalidOid
,
InvalidOid
,
commuTup
->
oprresult
,
commuTup
->
oprresult
,
((
Oper
*
)
((
Expr
*
)
clause
)
->
oper
)
->
opsize
,
((
Oper
*
)
((
Expr
*
)
clause
)
->
oper
)
->
opsize
,
...
...
src/backend/parser/gram.c
View file @
6beba218
...
@@ -229,7 +229,7 @@
...
@@ -229,7 +229,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.
49 1998/11/22 10:48:45
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.
50 1998/11/27 19:52:09
vadim Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
...
src/backend/parser/parse_func.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.3
0 1998/10/08 18:29:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.3
1 1998/11/27 19:52:13 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -516,7 +516,7 @@ func_get_candidates(char *funcname, int nargs)
...
@@ -516,7 +516,7 @@ func_get_candidates(char *funcname, int nargs)
Relation
heapRelation
;
Relation
heapRelation
;
Relation
idesc
;
Relation
idesc
;
ScanKeyData
skey
;
ScanKeyData
skey
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
IndexScanDesc
sd
;
IndexScanDesc
sd
;
RetrieveIndexResult
indexRes
;
RetrieveIndexResult
indexRes
;
Form_pg_proc
pgProcP
;
Form_pg_proc
pgProcP
;
...
@@ -537,20 +537,17 @@ func_get_candidates(char *funcname, int nargs)
...
@@ -537,20 +537,17 @@ func_get_candidates(char *funcname, int nargs)
do
do
{
{
tuple
=
(
HeapTuple
)
NULL
;
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
);
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
);
if
(
indexRes
)
if
(
indexRes
)
{
{
ItemPointer
iptr
;
Buffer
buffer
;
Buffer
buffer
;
iptr
=
&
indexRes
->
heap_iptr
;
tuple
.
t_self
=
indexRes
->
heap_iptr
;
tuple
=
heap_fetch
(
heapRelation
,
SnapshotNow
,
iptr
,
&
buffer
);
heap_fetch
(
heapRelation
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
!=
NULL
)
{
{
pgProcP
=
(
Form_pg_proc
)
GETSTRUCT
(
tuple
);
pgProcP
=
(
Form_pg_proc
)
GETSTRUCT
(
&
tuple
);
if
(
pgProcP
->
pronargs
==
nargs
)
if
(
pgProcP
->
pronargs
==
nargs
)
{
{
current_candidate
=
(
CandidateList
)
current_candidate
=
(
CandidateList
)
...
@@ -884,7 +881,7 @@ func_get_detail(char *funcname,
...
@@ -884,7 +881,7 @@ func_get_detail(char *funcname,
else
else
{
{
pform
=
(
Form_pg_proc
)
GETSTRUCT
(
ftup
);
pform
=
(
Form_pg_proc
)
GETSTRUCT
(
ftup
);
*
funcid
=
ftup
->
t_oid
;
*
funcid
=
ftup
->
t_
data
->
t_
oid
;
*
rettype
=
pform
->
prorettype
;
*
rettype
=
pform
->
prorettype
;
*
retset
=
pform
->
proretset
;
*
retset
=
pform
->
proretset
;
...
...
src/backend/parser/parse_oper.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.2
0 1998/10/08 18:29:46 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.2
1 1998/11/27 19:52:14 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -61,7 +61,7 @@ any_ordering_op(int restype)
...
@@ -61,7 +61,7 @@ any_ordering_op(int restype)
Oid
Oid
oprid
(
Operator
op
)
oprid
(
Operator
op
)
{
{
return
op
->
t_oid
;
return
op
->
t_
data
->
t_
oid
;
}
}
...
@@ -426,7 +426,7 @@ oper_exact(char *op, Oid arg1, Oid arg2, Node **ltree, Node **rtree, bool noWarn
...
@@ -426,7 +426,7 @@ oper_exact(char *op, Oid arg1, Oid arg2, Node **ltree, Node **rtree, bool noWarn
Form_pg_operator
opform
;
Form_pg_operator
opform
;
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
tup
);
opform
=
(
Form_pg_operator
)
GETSTRUCT
(
tup
);
if
(
opform
->
oprcom
==
tup
->
t_oid
)
if
(
opform
->
oprcom
==
tup
->
t_
data
->
t_
oid
)
{
{
if
((
ltree
!=
NULL
)
&&
(
rtree
!=
NULL
))
if
((
ltree
!=
NULL
)
&&
(
rtree
!=
NULL
))
{
{
...
...
src/backend/parser/parse_type.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.1
7 1998/10/08 18:29:48 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.1
8 1998/11/27 19:52:14 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -96,7 +96,7 @@ typeTypeId(Type tp)
...
@@ -96,7 +96,7 @@ typeTypeId(Type tp)
{
{
if
(
tp
==
NULL
)
if
(
tp
==
NULL
)
elog
(
ERROR
,
"typeTypeId() called with NULL type struct"
);
elog
(
ERROR
,
"typeTypeId() called with NULL type struct"
);
return
tp
->
t_oid
;
return
tp
->
t_
data
->
t_
oid
;
}
}
/* given type (as type struct), return the length of type */
/* given type (as type struct), return the length of type */
...
...
src/backend/rewrite/rewriteRemove.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.1
8 1998/09/01 04:31:36 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.1
9 1998/11/27 19:52:17 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -101,7 +101,7 @@ RemoveRewriteRule(char *ruleName)
...
@@ -101,7 +101,7 @@ RemoveRewriteRule(char *ruleName)
* Store the OID of the rule (i.e. the tuple's OID) and the event
* Store the OID of the rule (i.e. the tuple's OID) and the event
* relation's OID
* relation's OID
*/
*/
ruleId
=
tuple
->
t_oid
;
ruleId
=
tuple
->
t_
data
->
t_
oid
;
eventRelationOidDatum
=
heap_getattr
(
tuple
,
eventRelationOidDatum
=
heap_getattr
(
tuple
,
Anum_pg_rewrite_ev_class
,
Anum_pg_rewrite_ev_class
,
RelationGetDescr
(
RewriteRelation
),
RelationGetDescr
(
RewriteRelation
),
...
@@ -125,7 +125,7 @@ RemoveRewriteRule(char *ruleName)
...
@@ -125,7 +125,7 @@ RemoveRewriteRule(char *ruleName)
/*
/*
* Now delete the tuple...
* Now delete the tuple...
*/
*/
heap_delete
(
RewriteRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
RewriteRelation
,
&
tuple
->
t_
self
);
pfree
(
tuple
);
pfree
(
tuple
);
heap_close
(
RewriteRelation
);
heap_close
(
RewriteRelation
);
...
@@ -162,7 +162,7 @@ RelationRemoveRules(Oid relid)
...
@@ -162,7 +162,7 @@ RelationRemoveRules(Oid relid)
0
,
SnapshotNow
,
1
,
&
scanKeyData
);
0
,
SnapshotNow
,
1
,
&
scanKeyData
);
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scanDesc
,
0
)))
while
(
HeapTupleIsValid
(
tuple
=
heap_getnext
(
scanDesc
,
0
)))
heap_delete
(
RewriteRelation
,
&
tuple
->
t_
ctid
);
heap_delete
(
RewriteRelation
,
&
tuple
->
t_
self
);
heap_endscan
(
scanDesc
);
heap_endscan
(
scanDesc
);
heap_close
(
RewriteRelation
);
heap_close
(
RewriteRelation
);
...
...
src/backend/rewrite/rewriteSupport.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.2
8 1998/09/01 04:31:37 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.2
9 1998/11/27 19:52:18 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -128,7 +128,7 @@ setRelhasrulesInRelation(Oid relationId, bool relhasrules)
...
@@ -128,7 +128,7 @@ setRelhasrulesInRelation(Oid relationId, bool relhasrules)
relationRelation
=
heap_openr
(
RelationRelationName
);
relationRelation
=
heap_openr
(
RelationRelationName
);
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relhasrules
=
relhasrules
;
((
Form_pg_class
)
GETSTRUCT
(
tuple
))
->
relhasrules
=
relhasrules
;
heap_replace
(
relationRelation
,
&
tuple
->
t_
ctid
,
tuple
);
heap_replace
(
relationRelation
,
&
tuple
->
t_
self
,
tuple
);
/* keep the catalog indices up to date */
/* keep the catalog indices up to date */
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
idescs
);
CatalogOpenIndices
(
Num_pg_class_indices
,
Name_pg_class_indices
,
idescs
);
...
...
src/backend/storage/large_object/inv_api.c
View file @
6beba218
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.4
1 1998/10/06 03:55:43 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.4
2 1998/11/27 19:52:19 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -80,7 +80,7 @@
...
@@ -80,7 +80,7 @@
/* non-export function prototypes */
/* non-export function prototypes */
static
HeapTuple
inv_newtuple
(
LargeObjectDesc
*
obj_desc
,
Buffer
buffer
,
static
HeapTuple
inv_newtuple
(
LargeObjectDesc
*
obj_desc
,
Buffer
buffer
,
Page
page
,
char
*
dbuf
,
int
nwrite
);
Page
page
,
char
*
dbuf
,
int
nwrite
);
static
HeapTuple
inv_fetchtup
(
LargeObjectDesc
*
obj_desc
,
Buffer
*
buffer
);
static
void
inv_fetchtup
(
LargeObjectDesc
*
obj_desc
,
HeapTuple
tuple
,
Buffer
*
buffer
);
static
int
inv_wrnew
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
);
static
int
inv_wrnew
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
);
static
int
inv_wrold
(
LargeObjectDesc
*
obj_desc
,
char
*
dbuf
,
int
nbytes
,
static
int
inv_wrold
(
LargeObjectDesc
*
obj_desc
,
char
*
dbuf
,
int
nbytes
,
HeapTuple
tuple
,
Buffer
buffer
);
HeapTuple
tuple
,
Buffer
buffer
);
...
@@ -440,7 +440,7 @@ inv_tell(LargeObjectDesc *obj_desc)
...
@@ -440,7 +440,7 @@ inv_tell(LargeObjectDesc *obj_desc)
int
int
inv_read
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
)
inv_read
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
)
{
{
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
int
nread
;
int
nread
;
int
off
;
int
off
;
int
ncopy
;
int
ncopy
;
...
@@ -470,16 +470,16 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -470,16 +470,16 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
Buffer
buffer
;
Buffer
buffer
;
/* fetch an inversion file system block */
/* fetch an inversion file system block */
tuple
=
inv_fetchtup
(
obj_desc
,
&
buffer
);
inv_fetchtup
(
obj_desc
,
&
tuple
,
&
buffer
);
if
(
!
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
==
NULL
)
{
{
obj_desc
->
flags
|=
IFS_ATEOF
;
obj_desc
->
flags
|=
IFS_ATEOF
;
break
;
break
;
}
}
/* copy the data from this block into the buffer */
/* copy the data from this block into the buffer */
d
=
heap_getattr
(
tuple
,
2
,
obj_desc
->
hdesc
,
&
isNull
);
d
=
heap_getattr
(
&
tuple
,
2
,
obj_desc
->
hdesc
,
&
isNull
);
ReleaseBuffer
(
buffer
);
ReleaseBuffer
(
buffer
);
fsblock
=
(
struct
varlena
*
)
DatumGetPointer
(
d
);
fsblock
=
(
struct
varlena
*
)
DatumGetPointer
(
d
);
...
@@ -502,7 +502,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -502,7 +502,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
int
int
inv_write
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
)
inv_write
(
LargeObjectDesc
*
obj_desc
,
char
*
buf
,
int
nbytes
)
{
{
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
int
nwritten
;
int
nwritten
;
int
tuplen
;
int
tuplen
;
...
@@ -536,19 +536,19 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -536,19 +536,19 @@ inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes)
if
((
obj_desc
->
flags
&
IFS_ATEOF
)
if
((
obj_desc
->
flags
&
IFS_ATEOF
)
||
obj_desc
->
heap_r
->
rd_nblocks
==
0
)
||
obj_desc
->
heap_r
->
rd_nblocks
==
0
)
tuple
=
(
HeapTuple
)
NULL
;
tuple
.
t_data
=
NULL
;
else
else
tuple
=
inv_fetchtup
(
obj_desc
,
&
buffer
);
inv_fetchtup
(
obj_desc
,
&
tuple
,
&
buffer
);
/* either append or replace a block, as required */
/* either append or replace a block, as required */
if
(
!
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
==
NULL
)
tuplen
=
inv_wrnew
(
obj_desc
,
buf
,
nbytes
-
nwritten
);
tuplen
=
inv_wrnew
(
obj_desc
,
buf
,
nbytes
-
nwritten
);
else
else
{
{
if
(
obj_desc
->
offset
>
obj_desc
->
highbyte
)
if
(
obj_desc
->
offset
>
obj_desc
->
highbyte
)
tuplen
=
inv_wrnew
(
obj_desc
,
buf
,
nbytes
-
nwritten
);
tuplen
=
inv_wrnew
(
obj_desc
,
buf
,
nbytes
-
nwritten
);
else
else
tuplen
=
inv_wrold
(
obj_desc
,
buf
,
nbytes
-
nwritten
,
tuple
,
buffer
);
tuplen
=
inv_wrold
(
obj_desc
,
buf
,
nbytes
-
nwritten
,
&
tuple
,
buffer
);
}
}
ReleaseBuffer
(
buffer
);
ReleaseBuffer
(
buffer
);
...
@@ -602,10 +602,9 @@ inv_cleanindex(LargeObjectDesc *obj_desc)
...
@@ -602,10 +602,9 @@ inv_cleanindex(LargeObjectDesc *obj_desc)
* A heap tuple containing the desired block, or NULL if no
* A heap tuple containing the desired block, or NULL if no
* such tuple exists.
* such tuple exists.
*/
*/
static
HeapTuple
static
void
inv_fetchtup
(
LargeObjectDesc
*
obj_desc
,
Buffer
*
buffer
)
inv_fetchtup
(
LargeObjectDesc
*
obj_desc
,
HeapTuple
tuple
,
Buffer
*
buffer
)
{
{
HeapTuple
tuple
;
RetrieveIndexResult
res
;
RetrieveIndexResult
res
;
Datum
d
;
Datum
d
;
int
firstbyte
,
int
firstbyte
,
...
@@ -650,7 +649,8 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
...
@@ -650,7 +649,8 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
if
(
res
==
(
RetrieveIndexResult
)
NULL
)
if
(
res
==
(
RetrieveIndexResult
)
NULL
)
{
{
ItemPointerSetInvalid
(
&
(
obj_desc
->
htid
));
ItemPointerSetInvalid
(
&
(
obj_desc
->
htid
));
return
(
HeapTuple
)
NULL
;
tuple
->
t_data
=
NULL
;
return
;
}
}
/*
/*
...
@@ -662,19 +662,18 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
...
@@ -662,19 +662,18 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
* way... - vadim 07/28/98
* way... - vadim 07/28/98
*
*
*/
*/
tuple
->
t_self
=
res
->
heap_iptr
;
tuple
=
heap_fetch
(
obj_desc
->
heap_r
,
SnapshotNow
,
heap_fetch
(
obj_desc
->
heap_r
,
SnapshotNow
,
tuple
,
buffer
);
&
res
->
heap_iptr
,
buffer
);
pfree
(
res
);
pfree
(
res
);
}
while
(
tuple
==
(
HeapTuple
)
NULL
);
}
while
(
tuple
->
t_data
==
NULL
);
/* remember this tid -- we may need it for later reads/writes */
/* remember this tid -- we may need it for later reads/writes */
ItemPointerCopy
(
&
tuple
->
t_ctid
,
&
obj_desc
->
htid
);
ItemPointerCopy
(
&
(
tuple
->
t_self
)
,
&
obj_desc
->
htid
);
}
}
else
else
{
{
tuple
=
heap_fetch
(
obj_desc
->
heap_r
,
SnapshotNow
,
tuple
->
t_self
=
obj_desc
->
htid
;
&
(
obj_desc
->
htid
)
,
buffer
);
heap_fetch
(
obj_desc
->
heap_r
,
SnapshotNow
,
tuple
,
buffer
);
}
}
/*
/*
...
@@ -697,7 +696,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
...
@@ -697,7 +696,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *buffer)
obj_desc
->
lowbyte
=
firstbyte
;
obj_desc
->
lowbyte
=
firstbyte
;
obj_desc
->
highbyte
=
lastbyte
;
obj_desc
->
highbyte
=
lastbyte
;
return
tuple
;
return
;
}
}
/*
/*
...
@@ -786,6 +785,7 @@ inv_wrnew(LargeObjectDesc *obj_desc, char *buf, int nbytes)
...
@@ -786,6 +785,7 @@ inv_wrnew(LargeObjectDesc *obj_desc, char *buf, int nbytes)
ntup
=
inv_newtuple
(
obj_desc
,
buffer
,
page
,
buf
,
nwritten
);
ntup
=
inv_newtuple
(
obj_desc
,
buffer
,
page
,
buf
,
nwritten
);
inv_indextup
(
obj_desc
,
ntup
);
inv_indextup
(
obj_desc
,
ntup
);
pfree
(
ntup
);
/* new tuple is inserted */
/* new tuple is inserted */
WriteBuffer
(
buffer
);
WriteBuffer
(
buffer
);
...
@@ -822,9 +822,9 @@ inv_wrold(LargeObjectDesc *obj_desc,
...
@@ -822,9 +822,9 @@ inv_wrold(LargeObjectDesc *obj_desc,
* abstraction.
* abstraction.
*/
*/
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tuple
->
t_xmax
));
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tuple
->
t_
data
->
t_
xmax
));
tuple
->
t_cmax
=
GetCurrentCommandId
();
tuple
->
t_
data
->
t_
cmax
=
GetCurrentCommandId
();
tuple
->
t_infomask
&=
~
(
HEAP_XMAX_COMMITTED
|
HEAP_XMAX_INVALID
);
tuple
->
t_
data
->
t_
infomask
&=
~
(
HEAP_XMAX_COMMITTED
|
HEAP_XMAX_INVALID
);
/*
/*
* If we're overwriting the entire block, we're lucky. All we need to
* If we're overwriting the entire block, we're lucky. All we need to
...
@@ -953,6 +953,7 @@ inv_wrold(LargeObjectDesc *obj_desc,
...
@@ -953,6 +953,7 @@ inv_wrold(LargeObjectDesc *obj_desc,
/* index the new tuple */
/* index the new tuple */
inv_indextup
(
obj_desc
,
ntup
);
inv_indextup
(
obj_desc
,
ntup
);
pfree
(
ntup
);
/*
/*
* move the scandesc forward so we don't reread the newly inserted
* move the scandesc forward so we don't reread the newly inserted
...
@@ -985,7 +986,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
...
@@ -985,7 +986,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
char
*
dbuf
,
char
*
dbuf
,
int
nwrite
)
int
nwrite
)
{
{
HeapTuple
ntup
;
HeapTuple
ntup
=
(
HeapTuple
)
palloc
(
sizeof
(
HeapTupleData
))
;
PageHeader
ph
;
PageHeader
ph
;
int
tupsize
;
int
tupsize
;
int
hoff
;
int
hoff
;
...
@@ -997,7 +998,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
...
@@ -997,7 +998,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
char
*
attptr
;
char
*
attptr
;
/* compute tuple size -- no nulls */
/* compute tuple size -- no nulls */
hoff
=
offsetof
(
HeapTupleData
,
t_bits
);
hoff
=
offsetof
(
HeapTuple
Header
Data
,
t_bits
);
/* add in olastbyte, varlena.vl_len, varlena.vl_dat */
/* add in olastbyte, varlena.vl_len, varlena.vl_dat */
tupsize
=
hoff
+
(
2
*
sizeof
(
int32
))
+
nwrite
;
tupsize
=
hoff
+
(
2
*
sizeof
(
int32
))
+
nwrite
;
...
@@ -1036,7 +1037,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
...
@@ -1036,7 +1037,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
ph
->
pd_lower
=
lower
;
ph
->
pd_lower
=
lower
;
ph
->
pd_upper
=
upper
;
ph
->
pd_upper
=
upper
;
ntup
=
(
HeapTuple
)
((
char
*
)
page
+
upper
);
ntup
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
page
+
upper
);
/*
/*
* Tuple is now allocated on the page. Next, fill in the tuple
* Tuple is now allocated on the page. Next, fill in the tuple
...
@@ -1044,15 +1045,15 @@ inv_newtuple(LargeObjectDesc *obj_desc,
...
@@ -1044,15 +1045,15 @@ inv_newtuple(LargeObjectDesc *obj_desc,
*/
*/
ntup
->
t_len
=
tupsize
;
ntup
->
t_len
=
tupsize
;
ItemPointerSet
(
&
ntup
->
t_
ctid
,
BufferGetBlockNumber
(
buffer
),
off
);
ItemPointerSet
(
&
ntup
->
t_
self
,
BufferGetBlockNumber
(
buffer
),
off
);
LastOidProcessed
=
ntup
->
t_oid
=
newoid
();
LastOidProcessed
=
ntup
->
t_
data
->
t_
oid
=
newoid
();
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
ntup
->
t_xmin
));
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
ntup
->
t_
data
->
t_
xmin
));
ntup
->
t_cmin
=
GetCurrentCommandId
();
ntup
->
t_
data
->
t_
cmin
=
GetCurrentCommandId
();
StoreInvalidTransactionId
(
&
(
ntup
->
t_xmax
));
StoreInvalidTransactionId
(
&
(
ntup
->
t_
data
->
t_
xmax
));
ntup
->
t_cmax
=
0
;
ntup
->
t_
data
->
t_
cmax
=
0
;
ntup
->
t_infomask
=
HEAP_XMAX_INVALID
;
ntup
->
t_
data
->
t_
infomask
=
HEAP_XMAX_INVALID
;
ntup
->
t_natts
=
2
;
ntup
->
t_
data
->
t_
natts
=
2
;
ntup
->
t_hoff
=
hoff
;
ntup
->
t_
data
->
t_
hoff
=
hoff
;
/* if a NULL is passed in, avoid the calculations below */
/* if a NULL is passed in, avoid the calculations below */
if
(
dbuf
==
NULL
)
if
(
dbuf
==
NULL
)
...
@@ -1063,7 +1064,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
...
@@ -1063,7 +1064,7 @@ inv_newtuple(LargeObjectDesc *obj_desc,
* the tuple and class abstractions.
* the tuple and class abstractions.
*/
*/
attptr
=
((
char
*
)
ntup
)
+
hoff
;
attptr
=
((
char
*
)
ntup
->
t_data
)
+
hoff
;
*
((
int32
*
)
attptr
)
=
obj_desc
->
offset
+
nwrite
-
1
;
*
((
int32
*
)
attptr
)
=
obj_desc
->
offset
+
nwrite
-
1
;
attptr
+=
sizeof
(
int32
);
attptr
+=
sizeof
(
int32
);
...
@@ -1106,7 +1107,7 @@ inv_indextup(LargeObjectDesc *obj_desc, HeapTuple tuple)
...
@@ -1106,7 +1107,7 @@ inv_indextup(LargeObjectDesc *obj_desc, HeapTuple tuple)
n
[
0
]
=
' '
;
n
[
0
]
=
' '
;
v
[
0
]
=
Int32GetDatum
(
obj_desc
->
highbyte
);
v
[
0
]
=
Int32GetDatum
(
obj_desc
->
highbyte
);
res
=
index_insert
(
obj_desc
->
index_r
,
&
v
[
0
],
&
n
[
0
],
res
=
index_insert
(
obj_desc
->
index_r
,
&
v
[
0
],
&
n
[
0
],
&
(
tuple
->
t_
ctid
),
obj_desc
->
heap_r
);
&
(
tuple
->
t_
self
),
obj_desc
->
heap_r
);
if
(
res
)
if
(
res
)
pfree
(
res
);
pfree
(
res
);
...
@@ -1209,7 +1210,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
...
@@ -1209,7 +1210,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
{
{
IndexScanDesc
iscan
;
IndexScanDesc
iscan
;
RetrieveIndexResult
res
;
RetrieveIndexResult
res
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
Datum
d
;
Datum
d
;
long
size
;
long
size
;
bool
isNull
;
bool
isNull
;
...
@@ -1239,16 +1240,17 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
...
@@ -1239,16 +1240,17 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
* rather that NowTimeQual. We currently have no way to pass a
* rather that NowTimeQual. We currently have no way to pass a
* time qual in.
* time qual in.
*/
*/
tuple
=
heap_fetch
(
hreln
,
SnapshotNow
,
&
res
->
heap_iptr
,
&
buffer
);
tuple
.
t_self
=
res
->
heap_iptr
;
heap_fetch
(
hreln
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
res
);
pfree
(
res
);
}
while
(
!
HeapTupleIsValid
(
tuple
)
);
}
while
(
tuple
.
t_data
==
NULL
);
/* don't need the index scan anymore */
/* don't need the index scan anymore */
index_endscan
(
iscan
);
index_endscan
(
iscan
);
pfree
(
iscan
);
pfree
(
iscan
);
/* get olastbyte attribute */
/* get olastbyte attribute */
d
=
heap_getattr
(
tuple
,
1
,
hdesc
,
&
isNull
);
d
=
heap_getattr
(
&
tuple
,
1
,
hdesc
,
&
isNull
);
size
=
DatumGetInt32
(
d
)
+
1
;
size
=
DatumGetInt32
(
d
)
+
1
;
ReleaseBuffer
(
buffer
);
ReleaseBuffer
(
buffer
);
...
...
src/backend/utils/adt/regproc.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.3
2 1998/10/02 05:31:28 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.3
3 1998/11/27 19:52:22 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -42,6 +42,7 @@ int32
...
@@ -42,6 +42,7 @@ int32
regprocin
(
char
*
pro_name_or_oid
)
regprocin
(
char
*
pro_name_or_oid
)
{
{
HeapTuple
proctup
=
NULL
;
HeapTuple
proctup
=
NULL
;
HeapTupleData
tuple
;
RegProcedure
result
=
InvalidOid
;
RegProcedure
result
=
InvalidOid
;
if
(
pro_name_or_oid
==
NULL
)
if
(
pro_name_or_oid
==
NULL
)
...
@@ -60,7 +61,7 @@ regprocin(char *pro_name_or_oid)
...
@@ -60,7 +61,7 @@ regprocin(char *pro_name_or_oid)
ObjectIdGetDatum
(
oidin
(
pro_name_or_oid
)),
ObjectIdGetDatum
(
oidin
(
pro_name_or_oid
)),
0
,
0
,
0
);
0
,
0
,
0
);
if
(
HeapTupleIsValid
(
proctup
))
if
(
HeapTupleIsValid
(
proctup
))
result
=
(
RegProcedure
)
proctup
->
t_oid
;
result
=
(
RegProcedure
)
proctup
->
t_
data
->
t_
oid
;
else
else
elog
(
ERROR
,
"No procedure with oid %s"
,
pro_name_or_oid
);
elog
(
ERROR
,
"No procedure with oid %s"
,
pro_name_or_oid
);
}
}
...
@@ -86,13 +87,14 @@ regprocin(char *pro_name_or_oid)
...
@@ -86,13 +87,14 @@ regprocin(char *pro_name_or_oid)
sd
=
index_beginscan
(
idesc
,
false
,
1
,
skey
);
sd
=
index_beginscan
(
idesc
,
false
,
1
,
skey
);
while
((
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
)))
while
((
indexRes
=
index_getnext
(
sd
,
ForwardScanDirection
)))
{
{
proctup
=
heap_fetch
(
hdesc
,
SnapshotNow
,
tuple
.
t_self
=
indexRes
->
heap_iptr
;
&
indexRes
->
heap_iptr
,
heap_fetch
(
hdesc
,
SnapshotNow
,
&
tuple
,
&
buffer
);
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
HeapTupleIsValid
(
proctup
)
)
if
(
tuple
.
t_data
!=
NULL
)
{
{
result
=
(
RegProcedure
)
proctup
->
t_oid
;
result
=
(
RegProcedure
)
tuple
.
t_data
->
t_oid
;
ReleaseBuffer
(
buffer
);
ReleaseBuffer
(
buffer
);
if
(
++
matches
>
1
)
if
(
++
matches
>
1
)
...
...
src/backend/utils/adt/sets.c
View file @
6beba218
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.1
8 1998/09/01 04:32:51 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.1
9 1998/11/27 19:52:23 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -123,10 +123,10 @@ SetDefine(char *querystr, char *typename)
...
@@ -123,10 +123,10 @@ SetDefine(char *querystr, char *typename)
repl
);
repl
);
setheapoverride
(
true
);
setheapoverride
(
true
);
heap_replace
(
procrel
,
&
tup
->
t_
ctid
,
newtup
);
heap_replace
(
procrel
,
&
tup
->
t_
self
,
newtup
);
setheapoverride
(
false
);
setheapoverride
(
false
);
setoid
=
newtup
->
t_oid
;
setoid
=
newtup
->
t_
data
->
t_
oid
;
}
}
else
else
elog
(
ERROR
,
"setin: could not find new set oid tuple"
);
elog
(
ERROR
,
"setin: could not find new set oid tuple"
);
...
...
src/backend/utils/cache/catcache.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.3
5 1998/10/12 00:53:33 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.3
6 1998/11/27 19:52:26 vadim
Exp $
*
*
* Notes:
* Notes:
* XXX This needs to use exception.h to handle recovery when
* XXX This needs to use exception.h to handle recovery when
...
@@ -386,7 +386,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
...
@@ -386,7 +386,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
case
4
:
case
4
:
cacheInOutP
->
cc_skey
[
3
].
sk_argument
=
cacheInOutP
->
cc_skey
[
3
].
sk_argument
=
(
cacheInOutP
->
cc_key
[
3
]
==
ObjectIdAttributeNumber
)
(
cacheInOutP
->
cc_key
[
3
]
==
ObjectIdAttributeNumber
)
?
(
Datum
)
tuple
->
t_oid
?
(
Datum
)
tuple
->
t_
data
->
t_
oid
:
fastgetattr
(
tuple
,
:
fastgetattr
(
tuple
,
cacheInOutP
->
cc_key
[
3
],
cacheInOutP
->
cc_key
[
3
],
RelationGetDescr
(
relation
),
RelationGetDescr
(
relation
),
...
@@ -396,7 +396,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
...
@@ -396,7 +396,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
case
3
:
case
3
:
cacheInOutP
->
cc_skey
[
2
].
sk_argument
=
cacheInOutP
->
cc_skey
[
2
].
sk_argument
=
(
cacheInOutP
->
cc_key
[
2
]
==
ObjectIdAttributeNumber
)
(
cacheInOutP
->
cc_key
[
2
]
==
ObjectIdAttributeNumber
)
?
(
Datum
)
tuple
->
t_oid
?
(
Datum
)
tuple
->
t_
data
->
t_
oid
:
fastgetattr
(
tuple
,
:
fastgetattr
(
tuple
,
cacheInOutP
->
cc_key
[
2
],
cacheInOutP
->
cc_key
[
2
],
RelationGetDescr
(
relation
),
RelationGetDescr
(
relation
),
...
@@ -406,7 +406,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
...
@@ -406,7 +406,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
case
2
:
case
2
:
cacheInOutP
->
cc_skey
[
1
].
sk_argument
=
cacheInOutP
->
cc_skey
[
1
].
sk_argument
=
(
cacheInOutP
->
cc_key
[
1
]
==
ObjectIdAttributeNumber
)
(
cacheInOutP
->
cc_key
[
1
]
==
ObjectIdAttributeNumber
)
?
(
Datum
)
tuple
->
t_oid
?
(
Datum
)
tuple
->
t_
data
->
t_
oid
:
fastgetattr
(
tuple
,
:
fastgetattr
(
tuple
,
cacheInOutP
->
cc_key
[
1
],
cacheInOutP
->
cc_key
[
1
],
RelationGetDescr
(
relation
),
RelationGetDescr
(
relation
),
...
@@ -416,7 +416,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
...
@@ -416,7 +416,7 @@ CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
case
1
:
case
1
:
cacheInOutP
->
cc_skey
[
0
].
sk_argument
=
cacheInOutP
->
cc_skey
[
0
].
sk_argument
=
(
cacheInOutP
->
cc_key
[
0
]
==
ObjectIdAttributeNumber
)
(
cacheInOutP
->
cc_key
[
0
]
==
ObjectIdAttributeNumber
)
?
(
Datum
)
tuple
->
t_oid
?
(
Datum
)
tuple
->
t_
data
->
t_
oid
:
fastgetattr
(
tuple
,
:
fastgetattr
(
tuple
,
cacheInOutP
->
cc_key
[
0
],
cacheInOutP
->
cc_key
[
0
],
RelationGetDescr
(
relation
),
RelationGetDescr
(
relation
),
...
@@ -513,7 +513,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
...
@@ -513,7 +513,7 @@ CatalogCacheIdInvalidate(int cacheId, /* XXX */
elt
=
DLGetSucc
(
elt
))
elt
=
DLGetSucc
(
elt
))
{
{
ct
=
(
CatCTup
*
)
DLE_VAL
(
elt
);
ct
=
(
CatCTup
*
)
DLE_VAL
(
elt
);
if
(
ItemPointerEquals
(
pointer
,
&
ct
->
ct_tup
->
t_
ctid
))
if
(
ItemPointerEquals
(
pointer
,
&
ct
->
ct_tup
->
t_
self
))
break
;
break
;
}
}
...
@@ -1141,7 +1141,7 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
...
@@ -1141,7 +1141,7 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
(
*
function
)
(
ccp
->
id
,
(
*
function
)
(
ccp
->
id
,
CatalogCacheComputeTupleHashIndex
(
ccp
,
relation
,
tuple
),
CatalogCacheComputeTupleHashIndex
(
ccp
,
relation
,
tuple
),
&
tuple
->
t_
ctid
);
&
tuple
->
t_
self
);
heap_close
(
relation
);
heap_close
(
relation
);
}
}
...
...
src/backend/utils/cache/fcache.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.1
8 1998/09/01 04:32:58 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.1
9 1998/11/27 19:52:27 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -74,7 +74,7 @@ GetDynamicFuncArgType(Var *arg, ExprContext *econtext)
...
@@ -74,7 +74,7 @@ GetDynamicFuncArgType(Var *arg, ExprContext *econtext)
elog
(
ERROR
,
"Lookup failed on type tuple for class %s"
,
elog
(
ERROR
,
"Lookup failed on type tuple for class %s"
,
relname
);
relname
);
return
tup
->
t_oid
;
return
tup
->
t_
data
->
t_
oid
;
}
}
static
FunctionCachePtr
static
FunctionCachePtr
...
...
src/backend/utils/cache/inval.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.1
7 1998/10/12 00:53:34 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.1
8 1998/11/27 19:52:28 vadim
Exp $
*
*
* Note - this code is real crufty...
* Note - this code is real crufty...
*
*
...
@@ -250,25 +250,25 @@ getmyrelids()
...
@@ -250,25 +250,25 @@ getmyrelids()
PointerGetDatum
(
RelationRelationName
),
PointerGetDatum
(
RelationRelationName
),
0
,
0
,
0
);
0
,
0
,
0
);
Assert
(
HeapTupleIsValid
(
tuple
));
Assert
(
HeapTupleIsValid
(
tuple
));
MyRelationRelationId
=
tuple
->
t_oid
;
MyRelationRelationId
=
tuple
->
t_
data
->
t_
oid
;
tuple
=
SearchSysCacheTuple
(
RELNAME
,
tuple
=
SearchSysCacheTuple
(
RELNAME
,
PointerGetDatum
(
AttributeRelationName
),
PointerGetDatum
(
AttributeRelationName
),
0
,
0
,
0
);
0
,
0
,
0
);
Assert
(
HeapTupleIsValid
(
tuple
));
Assert
(
HeapTupleIsValid
(
tuple
));
MyAttributeRelationId
=
tuple
->
t_oid
;
MyAttributeRelationId
=
tuple
->
t_
data
->
t_
oid
;
tuple
=
SearchSysCacheTuple
(
RELNAME
,
tuple
=
SearchSysCacheTuple
(
RELNAME
,
PointerGetDatum
(
AccessMethodRelationName
),
PointerGetDatum
(
AccessMethodRelationName
),
0
,
0
,
0
);
0
,
0
,
0
);
Assert
(
HeapTupleIsValid
(
tuple
));
Assert
(
HeapTupleIsValid
(
tuple
));
MyAMRelationId
=
tuple
->
t_oid
;
MyAMRelationId
=
tuple
->
t_
data
->
t_
oid
;
tuple
=
SearchSysCacheTuple
(
RELNAME
,
tuple
=
SearchSysCacheTuple
(
RELNAME
,
PointerGetDatum
(
AccessMethodOperatorRelationName
),
PointerGetDatum
(
AccessMethodOperatorRelationName
),
0
,
0
,
0
);
0
,
0
,
0
);
Assert
(
HeapTupleIsValid
(
tuple
));
Assert
(
HeapTupleIsValid
(
tuple
));
MyAMOPRelationId
=
tuple
->
t_oid
;
MyAMOPRelationId
=
tuple
->
t_
data
->
t_
oid
;
}
}
/* --------------------------------
/* --------------------------------
...
@@ -481,11 +481,11 @@ RelationInvalidateRelationCache(Relation relation,
...
@@ -481,11 +481,11 @@ RelationInvalidateRelationCache(Relation relation,
* ----------------
* ----------------
*/
*/
if
(
relationId
==
MyRelationRelationId
)
if
(
relationId
==
MyRelationRelationId
)
objectId
=
tuple
->
t_oid
;
objectId
=
tuple
->
t_
data
->
t_
oid
;
else
if
(
relationId
==
MyAttributeRelationId
)
else
if
(
relationId
==
MyAttributeRelationId
)
objectId
=
((
Form_pg_attribute
)
GETSTRUCT
(
tuple
))
->
attrelid
;
objectId
=
((
Form_pg_attribute
)
GETSTRUCT
(
tuple
))
->
attrelid
;
else
if
(
relationId
==
MyAMRelationId
)
else
if
(
relationId
==
MyAMRelationId
)
objectId
=
tuple
->
t_oid
;
objectId
=
tuple
->
t_
data
->
t_
oid
;
else
if
(
relationId
==
MyAMOPRelationId
)
else
if
(
relationId
==
MyAMOPRelationId
)
{
{
;
/* objectId is unused */
;
/* objectId is unused */
...
...
src/backend/utils/cache/relcache.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.5
0 1998/09/01 04:33:02 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.5
1 1998/11/27 19:52:28 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -383,10 +383,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
...
@@ -383,10 +383,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
* this bug is discovered and killed by wei on 9/27/91.
* this bug is discovered and killed by wei on 9/27/91.
* -------------------
* -------------------
*/
*/
return_tuple
=
(
HeapTuple
)
palloc
((
Size
)
pg_class_tuple
->
t_len
);
return_tuple
=
heap_copytuple
(
pg_class_tuple
);
memmove
((
char
*
)
return_tuple
,
(
char
*
)
pg_class_tuple
,
(
int
)
pg_class_tuple
->
t_len
);
}
}
/* all done */
/* all done */
...
@@ -718,7 +715,7 @@ RelationBuildRuleLock(Relation relation)
...
@@ -718,7 +715,7 @@ RelationBuildRuleLock(Relation relation)
rule
=
(
RewriteRule
*
)
palloc
(
sizeof
(
RewriteRule
));
rule
=
(
RewriteRule
*
)
palloc
(
sizeof
(
RewriteRule
));
rule
->
ruleId
=
pg_rewrite_tuple
->
t_oid
;
rule
->
ruleId
=
pg_rewrite_tuple
->
t_
data
->
t_
oid
;
rule
->
event
=
rule
->
event
=
(
int
)
heap_getattr
(
pg_rewrite_tuple
,
(
int
)
heap_getattr
(
pg_rewrite_tuple
,
...
@@ -838,7 +835,7 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo)
...
@@ -838,7 +835,7 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo)
* get information from the pg_class_tuple
* get information from the pg_class_tuple
* ----------------
* ----------------
*/
*/
relid
=
pg_class_tuple
->
t_oid
;
relid
=
pg_class_tuple
->
t_
data
->
t_
oid
;
relp
=
(
Form_pg_class
)
GETSTRUCT
(
pg_class_tuple
);
relp
=
(
Form_pg_class
)
GETSTRUCT
(
pg_class_tuple
);
natts
=
relp
->
relnatts
;
natts
=
relp
->
relnatts
;
...
@@ -1661,11 +1658,10 @@ AttrDefaultFetch(Relation relation)
...
@@ -1661,11 +1658,10 @@ AttrDefaultFetch(Relation relation)
Relation
adrel
;
Relation
adrel
;
Relation
irel
;
Relation
irel
;
ScanKeyData
skey
;
ScanKeyData
skey
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
Form_pg_attrdef
adform
;
Form_pg_attrdef
adform
;
IndexScanDesc
sd
;
IndexScanDesc
sd
;
RetrieveIndexResult
indexRes
;
RetrieveIndexResult
indexRes
;
ItemPointer
iptr
;
struct
varlena
*
val
;
struct
varlena
*
val
;
bool
isnull
;
bool
isnull
;
int
found
;
int
found
;
...
@@ -1680,7 +1676,7 @@ AttrDefaultFetch(Relation relation)
...
@@ -1680,7 +1676,7 @@ AttrDefaultFetch(Relation relation)
adrel
=
heap_openr
(
AttrDefaultRelationName
);
adrel
=
heap_openr
(
AttrDefaultRelationName
);
irel
=
index_openr
(
AttrDefaultIndex
);
irel
=
index_openr
(
AttrDefaultIndex
);
sd
=
index_beginscan
(
irel
,
false
,
1
,
&
skey
);
sd
=
index_beginscan
(
irel
,
false
,
1
,
&
skey
);
tuple
=
(
HeapTuple
)
NULL
;
tuple
.
t_data
=
NULL
;
for
(
found
=
0
;;)
for
(
found
=
0
;;)
{
{
...
@@ -1690,13 +1686,13 @@ AttrDefaultFetch(Relation relation)
...
@@ -1690,13 +1686,13 @@ AttrDefaultFetch(Relation relation)
if
(
!
indexRes
)
if
(
!
indexRes
)
break
;
break
;
iptr
=
&
indexRes
->
heap_iptr
;
tuple
.
t_self
=
indexRes
->
heap_iptr
;
tuple
=
heap_fetch
(
adrel
,
SnapshotNow
,
iptr
,
&
buffer
);
heap_fetch
(
adrel
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
!
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
==
NULL
)
continue
;
continue
;
found
++
;
found
++
;
adform
=
(
Form_pg_attrdef
)
GETSTRUCT
(
tuple
);
adform
=
(
Form_pg_attrdef
)
GETSTRUCT
(
&
tuple
);
for
(
i
=
0
;
i
<
ndef
;
i
++
)
for
(
i
=
0
;
i
<
ndef
;
i
++
)
{
{
if
(
adform
->
adnum
!=
attrdef
[
i
].
adnum
)
if
(
adform
->
adnum
!=
attrdef
[
i
].
adnum
)
...
@@ -1706,7 +1702,7 @@ AttrDefaultFetch(Relation relation)
...
@@ -1706,7 +1702,7 @@ AttrDefaultFetch(Relation relation)
relation
->
rd_att
->
attrs
[
adform
->
adnum
-
1
]
->
attname
.
data
,
relation
->
rd_att
->
attrs
[
adform
->
adnum
-
1
]
->
attname
.
data
,
relation
->
rd_rel
->
relname
.
data
);
relation
->
rd_rel
->
relname
.
data
);
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_attrdef_adbin
,
Anum_pg_attrdef_adbin
,
adrel
->
rd_att
,
&
isnull
);
adrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
@@ -1714,7 +1710,7 @@ AttrDefaultFetch(Relation relation)
...
@@ -1714,7 +1710,7 @@ AttrDefaultFetch(Relation relation)
relation
->
rd_att
->
attrs
[
adform
->
adnum
-
1
]
->
attname
.
data
,
relation
->
rd_att
->
attrs
[
adform
->
adnum
-
1
]
->
attname
.
data
,
relation
->
rd_rel
->
relname
.
data
);
relation
->
rd_rel
->
relname
.
data
);
attrdef
[
i
].
adbin
=
textout
(
val
);
attrdef
[
i
].
adbin
=
textout
(
val
);
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_attrdef_adsrc
,
Anum_pg_attrdef_adsrc
,
adrel
->
rd_att
,
&
isnull
);
adrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
@@ -1750,10 +1746,9 @@ RelCheckFetch(Relation relation)
...
@@ -1750,10 +1746,9 @@ RelCheckFetch(Relation relation)
Relation
rcrel
;
Relation
rcrel
;
Relation
irel
;
Relation
irel
;
ScanKeyData
skey
;
ScanKeyData
skey
;
HeapTuple
tuple
;
HeapTuple
Data
tuple
;
IndexScanDesc
sd
;
IndexScanDesc
sd
;
RetrieveIndexResult
indexRes
;
RetrieveIndexResult
indexRes
;
ItemPointer
iptr
;
Name
rcname
;
Name
rcname
;
struct
varlena
*
val
;
struct
varlena
*
val
;
bool
isnull
;
bool
isnull
;
...
@@ -1768,7 +1763,7 @@ RelCheckFetch(Relation relation)
...
@@ -1768,7 +1763,7 @@ RelCheckFetch(Relation relation)
rcrel
=
heap_openr
(
RelCheckRelationName
);
rcrel
=
heap_openr
(
RelCheckRelationName
);
irel
=
index_openr
(
RelCheckIndex
);
irel
=
index_openr
(
RelCheckIndex
);
sd
=
index_beginscan
(
irel
,
false
,
1
,
&
skey
);
sd
=
index_beginscan
(
irel
,
false
,
1
,
&
skey
);
tuple
=
(
HeapTuple
)
NULL
;
tuple
.
t_data
=
NULL
;
for
(
found
=
0
;;)
for
(
found
=
0
;;)
{
{
...
@@ -1778,30 +1773,30 @@ RelCheckFetch(Relation relation)
...
@@ -1778,30 +1773,30 @@ RelCheckFetch(Relation relation)
if
(
!
indexRes
)
if
(
!
indexRes
)
break
;
break
;
iptr
=
&
indexRes
->
heap_iptr
;
tuple
.
t_self
=
indexRes
->
heap_iptr
;
tuple
=
heap_fetch
(
rcrel
,
SnapshotNow
,
iptr
,
&
buffer
);
heap_fetch
(
rcrel
,
SnapshotNow
,
&
tuple
,
&
buffer
);
pfree
(
indexRes
);
pfree
(
indexRes
);
if
(
!
HeapTupleIsValid
(
tuple
)
)
if
(
tuple
.
t_data
==
NULL
)
continue
;
continue
;
if
(
found
==
ncheck
)
if
(
found
==
ncheck
)
elog
(
ERROR
,
"RelCheckFetch: unexpected record found for rel %s"
,
elog
(
ERROR
,
"RelCheckFetch: unexpected record found for rel %s"
,
relation
->
rd_rel
->
relname
.
data
);
relation
->
rd_rel
->
relname
.
data
);
rcname
=
(
Name
)
fastgetattr
(
tuple
,
rcname
=
(
Name
)
fastgetattr
(
&
tuple
,
Anum_pg_relcheck_rcname
,
Anum_pg_relcheck_rcname
,
rcrel
->
rd_att
,
&
isnull
);
rcrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
elog
(
ERROR
,
"RelCheckFetch: rcname IS NULL for rel %s"
,
elog
(
ERROR
,
"RelCheckFetch: rcname IS NULL for rel %s"
,
relation
->
rd_rel
->
relname
.
data
);
relation
->
rd_rel
->
relname
.
data
);
check
[
found
].
ccname
=
nameout
(
rcname
);
check
[
found
].
ccname
=
nameout
(
rcname
);
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_relcheck_rcbin
,
Anum_pg_relcheck_rcbin
,
rcrel
->
rd_att
,
&
isnull
);
rcrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
elog
(
ERROR
,
"RelCheckFetch: rcbin IS NULL for rel %s"
,
elog
(
ERROR
,
"RelCheckFetch: rcbin IS NULL for rel %s"
,
relation
->
rd_rel
->
relname
.
data
);
relation
->
rd_rel
->
relname
.
data
);
check
[
found
].
ccbin
=
textout
(
val
);
check
[
found
].
ccbin
=
textout
(
val
);
val
=
(
struct
varlena
*
)
fastgetattr
(
tuple
,
val
=
(
struct
varlena
*
)
fastgetattr
(
&
tuple
,
Anum_pg_relcheck_rcsrc
,
Anum_pg_relcheck_rcsrc
,
rcrel
->
rd_att
,
&
isnull
);
rcrel
->
rd_att
,
&
isnull
);
if
(
isnull
)
if
(
isnull
)
...
...
src/backend/utils/misc/database.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.2
0 1998/09/03 02:32:41 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.2
1 1998/11/27 19:52:29 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -188,7 +188,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
...
@@ -188,7 +188,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
int
nbytes
;
int
nbytes
;
int
max
,
int
max
,
i
;
i
;
HeapTuple
tup
;
HeapTuple
Data
tup
;
Page
pg
;
Page
pg
;
PageHeader
ph
;
PageHeader
ph
;
char
*
dbfname
;
char
*
dbfname
;
...
@@ -238,7 +238,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
...
@@ -238,7 +238,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
/* get a pointer to the tuple itself */
/* get a pointer to the tuple itself */
offset
=
(
int
)
ph
->
pd_linp
[
i
].
lp_off
;
offset
=
(
int
)
ph
->
pd_linp
[
i
].
lp_off
;
tup
=
(
HeapTuple
)
(((
char
*
)
pg
)
+
offset
);
tup
.
t_data
=
(
HeapTupleHeader
)
(((
char
*
)
pg
)
+
offset
);
/*
/*
* if the tuple has been deleted (the database was destroyed),
* if the tuple has been deleted (the database was destroyed),
...
@@ -253,7 +253,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
...
@@ -253,7 +253,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
* if data is ever moved and no longer the first field this
* if data is ever moved and no longer the first field this
* will be broken!! -mer 11 Nov 1991.
* will be broken!! -mer 11 Nov 1991.
*/
*/
if
(
TransactionIdIsValid
((
TransactionId
)
tup
->
t_xmax
))
if
(
TransactionIdIsValid
((
TransactionId
)
tup
.
t_data
->
t_xmax
))
continue
;
continue
;
/*
/*
...
@@ -267,7 +267,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
...
@@ -267,7 +267,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
* you exactly how big the header actually is. use the PC
* you exactly how big the header actually is. use the PC
* means of getting at sys cat attrs.
* means of getting at sys cat attrs.
*/
*/
tup_db
=
(
Form_pg_database
)
GETSTRUCT
(
tup
);
tup_db
=
(
Form_pg_database
)
GETSTRUCT
(
&
tup
);
#ifdef MULTIBYTE
#ifdef MULTIBYTE
/*
/*
...
@@ -279,7 +279,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
...
@@ -279,7 +279,7 @@ GetRawDatabaseInfo(char *name, int4 *owner, Oid *db_id, char *path, int *encodin
#endif
#endif
if
(
strcmp
(
name
,
tup_db
->
datname
.
data
)
==
0
)
if
(
strcmp
(
name
,
tup_db
->
datname
.
data
)
==
0
)
{
{
*
db_id
=
tup
->
t_oid
;
*
db_id
=
tup
.
t_data
->
t_oid
;
strncpy
(
path
,
VARDATA
(
&
(
tup_db
->
datpath
)),
strncpy
(
path
,
VARDATA
(
&
(
tup_db
->
datpath
)),
(
VARSIZE
(
&
(
tup_db
->
datpath
))
-
VARHDRSZ
));
(
VARSIZE
(
&
(
tup_db
->
datpath
))
-
VARHDRSZ
));
*
(
path
+
VARSIZE
(
&
(
tup_db
->
datpath
))
-
VARHDRSZ
)
=
'\0'
;
*
(
path
+
VARSIZE
(
&
(
tup_db
->
datpath
))
-
VARHDRSZ
)
=
'\0'
;
...
...
src/backend/utils/sort/psort.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.4
2 1998/09/01 03:27:13 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.4
3 1998/11/27 19:52:32 vadim
Exp $
*
*
* NOTES
* NOTES
* Sorts the first relation into the second relation.
* Sorts the first relation into the second relation.
...
@@ -66,7 +66,6 @@ static void initialrun(Sort *node);
...
@@ -66,7 +66,6 @@ static void initialrun(Sort *node);
static
void
inittapes
(
Sort
*
node
);
static
void
inittapes
(
Sort
*
node
);
static
void
merge
(
Sort
*
node
,
struct
tape
*
dest
);
static
void
merge
(
Sort
*
node
,
struct
tape
*
dest
);
static
FILE
*
mergeruns
(
Sort
*
node
);
static
FILE
*
mergeruns
(
Sort
*
node
);
static
HeapTuple
tuplecopy
(
HeapTuple
tup
);
static
int
_psort_cmp
(
HeapTuple
*
ltup
,
HeapTuple
*
rtup
);
static
int
_psort_cmp
(
HeapTuple
*
ltup
,
HeapTuple
*
rtup
);
...
@@ -224,9 +223,11 @@ inittapes(Sort *node)
...
@@ -224,9 +223,11 @@ inittapes(Sort *node)
#define PUTTUP(NODE, TUP, FP) \
#define PUTTUP(NODE, TUP, FP) \
( \
( \
(TUP)->t_len += HEAPTUPLESIZE, \
((Psortstate *)NODE->psortstate)->BytesWritten += (TUP)->t_len, \
((Psortstate *)NODE->psortstate)->BytesWritten += (TUP)->t_len, \
fwrite((char *)TUP, (TUP)->t_len, 1, FP), \
fwrite((char *)TUP, (TUP)->t_len, 1, FP), \
fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP) \
fwrite((char *)&((TUP)->t_len), sizeof (tlendummy), 1, FP), \
(TUP)->t_len -= HEAPTUPLESIZE \
)
)
#define ENDRUN(FP) fwrite((char *)&tlenzero, sizeof (tlenzero), 1, FP)
#define ENDRUN(FP) fwrite((char *)&tlenzero, sizeof (tlenzero), 1, FP)
...
@@ -237,10 +238,11 @@ inittapes(Sort *node)
...
@@ -237,10 +238,11 @@ inittapes(Sort *node)
IncrProcessed(), \
IncrProcessed(), \
((Psortstate *)NODE->psortstate)->BytesRead += (LEN) - sizeof (tlenzero), \
((Psortstate *)NODE->psortstate)->BytesRead += (LEN) - sizeof (tlenzero), \
fread((char *)(TUP) + sizeof (tlenzero), (LEN) - sizeof (tlenzero), 1, FP), \
fread((char *)(TUP) + sizeof (tlenzero), (LEN) - sizeof (tlenzero), 1, FP), \
(TUP)->t_data = (HeapTupleHeader) ((char *)(TUP) + HEAPTUPLESIZE), \
fread((char *)&tlendummy, sizeof (tlendummy), 1, FP) \
fread((char *)&tlendummy, sizeof (tlendummy), 1, FP) \
)
)
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN
#define SETTUPLEN(TUP, LEN) (TUP)->t_len = LEN
- HEAPTUPLESIZE
/*
/*
* USEMEM - record use of memory FREEMEM - record
* USEMEM - record use of memory FREEMEM - record
...
@@ -407,7 +409,7 @@ createfirstrun(Sort *node)
...
@@ -407,7 +409,7 @@ createfirstrun(Sort *node)
break
;
break
;
}
}
tup
=
tuplecopy
(
cr_slot
->
val
);
tup
=
heap_copytuple
(
cr_slot
->
val
);
ExecClearTuple
(
cr_slot
);
ExecClearTuple
(
cr_slot
);
IncrProcessed
();
IncrProcessed
();
...
@@ -524,7 +526,7 @@ createrun(Sort *node, FILE *file)
...
@@ -524,7 +526,7 @@ createrun(Sort *node, FILE *file)
}
}
else
else
{
{
tup
=
tuplecopy
(
cr_slot
->
val
);
tup
=
heap_copytuple
(
cr_slot
->
val
);
ExecClearTuple
(
cr_slot
);
ExecClearTuple
(
cr_slot
);
PS
(
node
)
->
tupcount
++
;
PS
(
node
)
->
tupcount
++
;
}
}
...
@@ -577,26 +579,6 @@ createrun(Sort *node, FILE *file)
...
@@ -577,26 +579,6 @@ createrun(Sort *node, FILE *file)
return
!
foundeor
;
return
!
foundeor
;
}
}
/*
* tuplecopy - see also tuple.c:palloctup()
*
* This should eventually go there under that name? And this will
* then use palloc directly (see version -r1.2).
*/
static
HeapTuple
tuplecopy
(
HeapTuple
tup
)
{
HeapTuple
rettup
;
if
(
!
HeapTupleIsValid
(
tup
))
{
return
NULL
;
/* just in case */
}
rettup
=
(
HeapTuple
)
palloc
(
tup
->
t_len
);
memmove
((
char
*
)
rettup
,
(
char
*
)
tup
,
tup
->
t_len
);
/* XXX */
return
rettup
;
}
/*
/*
* mergeruns - merges all runs from input tapes
* mergeruns - merges all runs from input tapes
* (polyphase merge Alg.D(D6)--Knuth, Vol.3, p271)
* (polyphase merge Alg.D(D6)--Knuth, Vol.3, p271)
...
@@ -792,7 +774,7 @@ psort_grabtuple(Sort *node, bool *should_free)
...
@@ -792,7 +774,7 @@ psort_grabtuple(Sort *node, bool *should_free)
return
NULL
;
return
NULL
;
if
(
GETLEN
(
tuplen
,
PS
(
node
)
->
psort_grab_file
)
&&
tuplen
!=
0
)
if
(
GETLEN
(
tuplen
,
PS
(
node
)
->
psort_grab_file
)
&&
tuplen
!=
0
)
{
{
tup
=
(
HeapTuple
)
palloc
((
unsigned
)
tuplen
);
tup
=
ALLOCTUP
(
tuplen
);
SETTUPLEN
(
tup
,
tuplen
);
SETTUPLEN
(
tup
,
tuplen
);
GETTUP
(
node
,
tup
,
tuplen
,
PS
(
node
)
->
psort_grab_file
);
GETTUP
(
node
,
tup
,
tuplen
,
PS
(
node
)
->
psort_grab_file
);
...
@@ -864,7 +846,7 @@ psort_grabtuple(Sort *node, bool *should_free)
...
@@ -864,7 +846,7 @@ psort_grabtuple(Sort *node, bool *should_free)
*/
*/
fseek
(
PS
(
node
)
->
psort_grab_file
,
fseek
(
PS
(
node
)
->
psort_grab_file
,
PS
(
node
)
->
psort_current
-
tuplen
,
SEEK_SET
);
PS
(
node
)
->
psort_current
-
tuplen
,
SEEK_SET
);
tup
=
(
HeapTuple
)
palloc
((
unsigned
)
tuplen
);
tup
=
ALLOCTUP
(
tuplen
);
SETTUPLEN
(
tup
,
tuplen
);
SETTUPLEN
(
tup
,
tuplen
);
GETTUP
(
node
,
tup
,
tuplen
,
PS
(
node
)
->
psort_grab_file
);
GETTUP
(
node
,
tup
,
tuplen
,
PS
(
node
)
->
psort_grab_file
);
return
tup
;
/* file position is equal to psort_current */
return
tup
;
/* file position is equal to psort_current */
...
...
src/backend/utils/time/tqual.c
View file @
6beba218
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.
19 1998/09/01 04:33:41 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.
20 1998/11/27 19:52:36 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -75,7 +75,7 @@ setheapoverride(bool on)
...
@@ -75,7 +75,7 @@ setheapoverride(bool on)
* Xmax is not committed))) that has not been committed
* Xmax is not committed))) that has not been committed
*/
*/
bool
bool
HeapTupleSatisfiesItself
(
HeapTuple
tuple
)
HeapTupleSatisfiesItself
(
HeapTuple
Header
tuple
)
{
{
if
(
!
(
tuple
->
t_infomask
&
HEAP_XMIN_COMMITTED
))
if
(
!
(
tuple
->
t_infomask
&
HEAP_XMIN_COMMITTED
))
...
@@ -171,7 +171,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
...
@@ -171,7 +171,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
* that do catalog accesses. this is unfortunate, but not critical.
* that do catalog accesses. this is unfortunate, but not critical.
*/
*/
bool
bool
HeapTupleSatisfiesNow
(
HeapTuple
tuple
)
HeapTupleSatisfiesNow
(
HeapTuple
Header
tuple
)
{
{
if
(
AMI_OVERRIDE
)
if
(
AMI_OVERRIDE
)
return
true
;
return
true
;
...
...
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