Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6562fa8

Browse files
committed
Fixes:
'select distinct on' causes backend to crash submitted by: Chris Dunlop chris@onthe.net.au
1 parent 9bffaad commit 6562fa8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/executor/nodeUnique.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.1.1.1 1996/07/09 06:21:27 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.2 1996/07/19 06:27:59 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -124,7 +124,7 @@ ExecUnique(Unique *node)
124124

125125
if (uniqueAttr) {
126126
tupDesc = ExecGetResultType(uniquestate);
127-
typoutput = typtoout((Oid)tupDesc->attrs[uniqueAttrNum]->atttypid);
127+
typoutput = typtoout((Oid)tupDesc->attrs[uniqueAttrNum-1]->atttypid);
128128
}
129129

130130
/* ----------------
@@ -174,8 +174,8 @@ ExecUnique(Unique *node)
174174
if (isNull1 == isNull2) {
175175
if (isNull1) /* both are null, they are equal */
176176
continue;
177-
val1 = fmgr(typoutput, attr1, gettypelem(tupDesc->attrs[uniqueAttrNum]->atttypid));
178-
val2 = fmgr(typoutput, attr2, gettypelem(tupDesc->attrs[uniqueAttrNum]->atttypid));
177+
val1 = fmgr(typoutput, attr1, gettypelem(tupDesc->attrs[uniqueAttrNum-1]->atttypid));
178+
val2 = fmgr(typoutput, attr2, gettypelem(tupDesc->attrs[uniqueAttrNum-1]->atttypid));
179179
/* now, val1 and val2 are ascii representations so we can
180180
use strcmp for comparison */
181181
if (strcmp(val1,val2) == 0) /* they are equal */

0 commit comments

Comments
 (0)