|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.9 1998/09/01 04:30:07 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.10 1999/02/01 04:20:50 tgl Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -120,16 +120,20 @@ extract_subkey(JoinKey *jk, int which_subkey)
|
120 | 120 | bool
|
121 | 121 | samekeys(List*keys1,List*keys2)
|
122 | 122 | {
|
123 |
| -boolallmember= true; |
124 | 123 | List*key1,
|
125 | 124 | *key2;
|
126 | 125 |
|
127 | 126 | for (key1=keys1,key2=keys2;key1!=NIL&&key2!=NIL;
|
128 | 127 | key1=lnext(key1),key2=lnext(key2))
|
129 | 128 | if (!member(lfirst(key1),lfirst(key2)))
|
130 |
| -allmember= false; |
131 |
| - |
132 |
| -if ((length(keys2) >=length(keys1))&&allmember) |
| 129 | +return false; |
| 130 | + |
| 131 | +/* Now the result should be true if list keys2 has at least as many |
| 132 | + * entries as keys1, ie, we did not fall off the end of keys2 first. |
| 133 | + * If key1 is now NIL then we hit the end of keys1 before or at the |
| 134 | + * same time as the end of keys2. |
| 135 | + */ |
| 136 | +if (key1==NIL) |
133 | 137 | return true;
|
134 | 138 | else
|
135 | 139 | return false;
|
|