Skip to content
Snippets Groups Projects
Commit dc374505 authored by Bruce Momjian's avatar Bruce Momjian
Browse files

Fix for psort again.

parent 677efc76
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.10 1997/08/06 07:39:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.11 1997/08/06 17:11:20 momjian Exp $
* *
* NOTES * NOTES
* Sorts the first relation into the second relation. * Sorts the first relation into the second relation.
...@@ -281,8 +281,14 @@ initialrun(Sort *node, bool *empty) ...@@ -281,8 +281,14 @@ initialrun(Sort *node, bool *empty)
inittapes(node); inittapes(node);
extrapasses = 0; extrapasses = 0;
} }
else else {
return; /* if rows fit in memory, we never access tape stuff */ /* if empty or rows fit in memory, we never access tape stuff */
if (*empty || ! PS(node)->using_tape_files)
return;
if (! PS(node)->using_tape_files)
inittapes(node);
extrapasses = 1 + (PS(node)->Tuples != NULL); /* (T != N) ? 2 : 1 */
}
for ( ; ; ) { for ( ; ; ) {
tp->tp_dummy--; tp->tp_dummy--;
...@@ -362,7 +368,8 @@ createrun(Sort *node, FILE *file, bool *empty) ...@@ -362,7 +368,8 @@ createrun(Sort *node, FILE *file, bool *empty)
&PS(node)->treeContext); &PS(node)->treeContext);
if (! PS(node)->using_tape_files) { if (! PS(node)->using_tape_files) {
inittapes(node); inittapes(node);
file = PS(node)->Tape->tp_file; /* was NULL */ if (! file)
file = PS(node)->Tape->tp_file; /* was NULL */
} }
PUTTUP(node, tup, file); PUTTUP(node, tup, file);
TRACEOUT(createrun, tup); TRACEOUT(createrun, tup);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment