diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-06-03 03:17:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-06-03 03:17:37 +0000 |
commit | f463c44fc069080af073e4df656a4e5ec44335c5 (patch) | |
tree | a9454b85e73e25d5aa390e78bc7affbd7a3faffc /src/backend/executor/nodeSort.c | |
parent | 9b3e2dda165bd0351f1ae518534acd1af7a15f00 (diff) | |
download | postgresql-f463c44fc069080af073e4df656a4e5ec44335c5.tar.gz postgresql-f463c44fc069080af073e4df656a4e5ec44335c5.zip |
Ensure consistent results when FormSortKeys fails to find
all the expected keys (it was returning uninitialized memory).
Diffstat (limited to 'src/backend/executor/nodeSort.c')
-rw-r--r-- | src/backend/executor/nodeSort.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c index 13a05948e70..1ca99c1bef7 100644 --- a/src/backend/executor/nodeSort.c +++ b/src/backend/executor/nodeSort.c @@ -7,11 +7,12 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.18 1999/02/13 23:15:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.19 1999/06/03 03:17:37 tgl Exp $ * *------------------------------------------------------------------------- */ #include "postgres.h" +#include <string.h> #include "executor/executor.h" #include "executor/execdebug.h" @@ -58,6 +59,7 @@ FormSortKeys(Sort *sortnode) if (keycount <= 0) elog(ERROR, "FormSortKeys: keycount <= 0"); sortkeys = (ScanKey) palloc(keycount * sizeof(ScanKeyData)); + MemSet((char *) sortkeys, 0, keycount * sizeof(ScanKeyData)); /* ---------------- * form each scan key from the resdom info in the target list @@ -72,7 +74,7 @@ FormSortKeys(Sort *sortnode) reskey = resdom->reskey; reskeyop = resdom->reskeyop; - if (reskey > 0) + if (reskey > 0) /* ignore TLEs that are not sort keys */ { ScanKeyEntryInitialize(&sortkeys[reskey - 1], 0, |