7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.18 1999/02/13 23:15:27 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.19 1999/06/03 03:17:37 tgl Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
14
14
#include "postgres.h"
15
+ #include <string.h>
15
16
16
17
#include "executor/executor.h"
17
18
#include "executor/execdebug.h"
@@ -58,6 +59,7 @@ FormSortKeys(Sort *sortnode)
58
59
if (keycount <=0 )
59
60
elog (ERROR ,"FormSortKeys: keycount <= 0" );
60
61
sortkeys = (ScanKey )palloc (keycount * sizeof (ScanKeyData ));
62
+ MemSet ((char * )sortkeys ,0 ,keycount * sizeof (ScanKeyData ));
61
63
62
64
/* ----------------
63
65
*form each scan key from the resdom info in the target list
@@ -72,7 +74,7 @@ FormSortKeys(Sort *sortnode)
72
74
reskey = resdom -> reskey ;
73
75
reskeyop = resdom -> reskeyop ;
74
76
75
- if (reskey > 0 )
77
+ if (reskey > 0 )/* ignore TLEs that are not sort keys */
76
78
{
77
79
ScanKeyEntryInitialize (& sortkeys [reskey - 1 ],
78
80
0 ,