Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc58fb21

Browse files
committed
From: Jeroen van Vianen <jeroenv@design.nl>
This patch solves the problem with multiple order by columns, with thefirst one having NULL values.
1 parentc16ebb0 commitc58fb21

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

‎src/backend/utils/sort/psort.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.33 1998/01/25 05:14:49 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.34 1998/01/25 05:18:34 scrappy Exp $
1111
*
1212
* NOTES
1313
*Sorts the first relation into the second relation.
@@ -1094,7 +1094,7 @@ _psort_cmp (HeapTuple *ltup, HeapTuple *rtup)
10941094
intresult=0;
10951095
boolisnull1,isnull2;
10961096

1097-
while (nkey<PsortNkeys&& !result )
1097+
for (nkey=0;nkey<PsortNkeys&& !result;nkey++ )
10981098
{
10991099
lattr=heap_getattr(*ltup,InvalidBuffer,
11001100
PsortKeys[nkey].sk_attno,
@@ -1106,14 +1106,13 @@ _psort_cmp (HeapTuple *ltup, HeapTuple *rtup)
11061106
&isnull2);
11071107
if (isnull1 )
11081108
{
1109-
if (isnull2 )
1110-
return (0);
1111-
return(1);
1109+
if ( !isnull2 )
1110+
result=1;
11121111
}
11131112
elseif (isnull2 )
1114-
return (-1);
1113+
result=-1;
11151114

1116-
if (PsortKeys[nkey].sk_flags&SK_COMMUTE)
1115+
elseif (PsortKeys[nkey].sk_flags&SK_COMMUTE)
11171116
{
11181117
if (!(result=-(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr,lattr)))
11191118
result= (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr,rattr);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp