Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
f3e9cf9c
Commit
f3e9cf9c
authored
27 years ago
by
Vadim B. Mikheev
Browse files
Options
Downloads
Patches
Plain Diff
Fix pfree problem.
parent
feb78cda
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/backend/executor/nodeSort.c
+4
-25
4 additions, 25 deletions
src/backend/executor/nodeSort.c
src/backend/utils/sort/psort.c
+7
-8
7 additions, 8 deletions
src/backend/utils/sort/psort.c
src/include/utils/psort.h
+2
-2
2 additions, 2 deletions
src/include/utils/psort.h
with
13 additions
and
35 deletions
src/backend/executor/nodeSort.c
+
4
−
25
View file @
f3e9cf9c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.
9
1997/09/
08 21:43:19 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.
10
1997/09/
15 14:27:37 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -112,6 +112,7 @@ ExecSort(Sort *node)
...
@@ -112,6 +112,7 @@ ExecSort(Sort *node)
ScanKey
sortkeys
;
ScanKey
sortkeys
;
HeapTuple
heapTuple
;
HeapTuple
heapTuple
;
TupleTableSlot
*
slot
;
TupleTableSlot
*
slot
;
bool
should_free
;
/* ----------------
/* ----------------
* get state info from node
* get state info from node
...
@@ -171,12 +172,7 @@ ExecSort(Sort *node)
...
@@ -171,12 +172,7 @@ ExecSort(Sort *node)
* ----------------
* ----------------
*/
*/
slot
=
(
TupleTableSlot
*
)
sortstate
->
csstate
.
cstate
.
cs_ResultTupleSlot
;
slot
=
(
TupleTableSlot
*
)
sortstate
->
csstate
.
cstate
.
cs_ResultTupleSlot
;
/* *** get_cs_ResultTupleSlot((CommonState) sortstate); */
slot
->
ttc_tupleDescriptor
=
ExecGetTupType
(
outerNode
);
slot
->
ttc_tupleDescriptor
=
ExecGetTupType
(
outerNode
);
#if 0
slot->ttc_execTupDescriptor = ExecGetExecTupDesc(outerNode);
#endif
/* ----------------
/* ----------------
* finally set the sorted flag to true
* finally set the sorted flag to true
* ----------------
* ----------------
...
@@ -198,26 +194,9 @@ ExecSort(Sort *node)
...
@@ -198,26 +194,9 @@ ExecSort(Sort *node)
* at this point we grab a tuple from psort
* at this point we grab a tuple from psort
* ----------------
* ----------------
*/
*/
heapTuple
=
psort_grabtuple
(
node
);
heapTuple
=
psort_grabtuple
(
node
,
&
should_free
);
if
(
heapTuple
==
NULL
)
{
/* psort_end(node); */
return
(
ExecClearTuple
(
slot
));
}
ExecStoreTuple
(
heapTuple
,
/* tuple to store */
return
(
ExecStoreTuple
(
heapTuple
,
slot
,
InvalidBuffer
,
should_free
));
slot
,
/* slot to store in */
InvalidBuffer
,
/* no buffer */
true
);
/* free the palloc'd tuple */
/* printf("ExecSort: (%x)",node);print_slot(slot);printf("\n");*/
return
slot
;
#if 0
return ExecStoreTuple(heapTuple, /* tuple to store */
slot, /* slot to store in */
InvalidBuffer, /* no buffer */
true);/* free the palloc'd tuple */
#endif
}
}
/* ----------------------------------------------------------------
/* ----------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
src/backend/utils/sort/psort.c
+
7
−
8
View file @
f3e9cf9c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.2
1
1997/09/
08 21:49:33 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.2
2
1997/09/
15 14:28:42 vadim
Exp $
*
*
* NOTES
* NOTES
* Sorts the first relation into the second relation.
* Sorts the first relation into the second relation.
...
@@ -128,8 +128,6 @@ psort_begin(Sort *node, int nkeys, ScanKey key)
...
@@ -128,8 +128,6 @@ psort_begin(Sort *node, int nkeys, ScanKey key)
bool
empty
;
/* to answer: is child node empty? */
bool
empty
;
/* to answer: is child node empty? */
node
->
psortstate
=
(
struct
Psortstate
*
)
palloc
(
sizeof
(
struct
Psortstate
));
node
->
psortstate
=
(
struct
Psortstate
*
)
palloc
(
sizeof
(
struct
Psortstate
));
if
(
node
->
psortstate
==
NULL
)
return
false
;
AssertArg
(
nkeys
>=
1
);
AssertArg
(
nkeys
>=
1
);
AssertArg
(
key
[
0
].
sk_attno
!=
0
);
AssertArg
(
key
[
0
].
sk_attno
!=
0
);
...
@@ -648,7 +646,7 @@ dumptuples(FILE *file, Sort *node)
...
@@ -648,7 +646,7 @@ dumptuples(FILE *file, Sort *node)
* a NULL indicating the last tuple has been processed.
* a NULL indicating the last tuple has been processed.
*/
*/
HeapTuple
HeapTuple
psort_grabtuple
(
Sort
*
node
)
psort_grabtuple
(
Sort
*
node
,
bool
*
should_free
)
{
{
register
HeapTuple
tup
;
register
HeapTuple
tup
;
long
tuplen
;
long
tuplen
;
...
@@ -668,7 +666,7 @@ psort_grabtuple(Sort *node)
...
@@ -668,7 +666,7 @@ psort_grabtuple(Sort *node)
/* Update current merged sort file position */
/* Update current merged sort file position */
PS
(
node
)
->
psort_current
+=
tuplen
;
PS
(
node
)
->
psort_current
+=
tuplen
;
*
should_free
=
true
;
return
tup
;
return
tup
;
}
}
else
else
...
@@ -680,7 +678,10 @@ psort_grabtuple(Sort *node)
...
@@ -680,7 +678,10 @@ psort_grabtuple(Sort *node)
else
else
{
{
if
(
PS
(
node
)
->
psort_current
<
PS
(
node
)
->
tupcount
)
if
(
PS
(
node
)
->
psort_current
<
PS
(
node
)
->
tupcount
)
return
PS
(
node
)
->
memtuples
[
PS
(
node
)
->
psort_current
++
];
{
*
should_free
=
false
;
return
(
PS
(
node
)
->
memtuples
[
PS
(
node
)
->
psort_current
++
]);
}
else
else
return
NULL
;
return
NULL
;
}
}
...
@@ -725,8 +726,6 @@ psort_end(Sort *node)
...
@@ -725,8 +726,6 @@ psort_end(Sort *node)
if
(
!
node
->
cleaned
)
if
(
!
node
->
cleaned
)
{
{
Assert
(
node
!=
(
Sort
*
)
NULL
);
Assert
(
node
!=
(
Sort
*
)
NULL
);
/* Assert(PS(node) != (Psortstate *) NULL); */
/*
/*
* I'm changing this because if we are sorting a relation with no
* I'm changing this because if we are sorting a relation with no
* tuples, psortstate is NULL.
* tuples, psortstate is NULL.
...
...
This diff is collapsed.
Click to expand it.
src/include/utils/psort.h
+
2
−
2
View file @
f3e9cf9c
...
@@ -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
*
*
* $Id: psort.h,v 1.1
0
1997/09/
08 21:55:14 momjian
Exp $
* $Id: psort.h,v 1.1
1
1997/09/
15 14:29:01 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -99,7 +99,7 @@ if (1) CODE; else
...
@@ -99,7 +99,7 @@ if (1) CODE; else
/* psort.c */
/* psort.c */
extern
bool
psort_begin
(
Sort
*
node
,
int
nkeys
,
ScanKey
key
);
extern
bool
psort_begin
(
Sort
*
node
,
int
nkeys
,
ScanKey
key
);
extern
HeapTuple
psort_grabtuple
(
Sort
*
node
);
extern
HeapTuple
psort_grabtuple
(
Sort
*
node
,
bool
*
should_free
);
extern
void
psort_markpos
(
Sort
*
node
);
extern
void
psort_markpos
(
Sort
*
node
);
extern
void
psort_restorepos
(
Sort
*
node
);
extern
void
psort_restorepos
(
Sort
*
node
);
extern
void
psort_end
(
Sort
*
node
);
extern
void
psort_end
(
Sort
*
node
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment