Optimizer fix for samekeys.

This commit is contained in:
Bruce Momjian 1999-02-09 06:30:45 +00:00
parent fe35ffe7e0
commit 78511d8fe9
3 changed files with 5732 additions and 5520 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.11 1999/02/09 03:51:26 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.12 1999/02/09 06:30:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -108,25 +108,35 @@ extract_subkey(JoinKey *jk, int which_subkey)
/*
* samekeys--
* Returns t iff two sets of path keys are equivalent. They are
* equivalent if the first subkey (var node) within each sublist of
* list 'keys1' is contained within the corresponding sublist of 'keys2'.
* equivalent if the first Var nodes match the second Var nodes.
*
* XXX It isn't necessary to check that each sublist exactly contain
* the same elements because if the routine that built these
* sublists together is correct, having one element in common
* implies having all elements in common.
* Huh? bjm
*
*/
bool
samekeys(List *keys1, List *keys2)
{
List *key1,
*key2;
*key2,
*key1a,
*key2a;
for (key1 = keys1, key2 = keys2; key1 != NIL && key2 != NIL;
for (key1 = keys1, key2 = keys2;
key1 != NIL && key2 != NIL;
key1 = lnext(key1), key2 = lnext(key2))
if (!member(lfirst((List *)lfirst(key1)), lfirst(key2)))
{
for (key1a = lfirst(key1), key2a = lfirst(key2);
key1a != NIL && key2a != NIL;
key1a = lnext(key1a), key2a = lnext(key2a))
if (!equal(lfirst(key1a), lfirst(key2a)))
return false;
if (key1a != NIL)
return false;
}
/* Now the result should be true if list keys2 has at least as many
* entries as keys1, ie, we did not fall off the end of keys2 first.

File diff suppressed because it is too large Load Diff

View File

@ -202,54 +202,56 @@ typedef union
#define INSTEAD 428
#define ISNULL 429
#define LANCOMPILER 430
#define LISTEN 431
#define LOAD 432
#define LOCATION 433
#define LOCK_P 434
#define MAXVALUE 435
#define MINVALUE 436
#define MOVE 437
#define NEW 438
#define NOCREATEDB 439
#define NOCREATEUSER 440
#define NONE 441
#define NOTHING 442
#define NOTIFY 443
#define NOTNULL 444
#define OIDS 445
#define OPERATOR 446
#define PASSWORD 447
#define PROCEDURAL 448
#define RECIPE 449
#define RENAME 450
#define RESET 451
#define RETURNS 452
#define ROW 453
#define RULE 454
#define SEQUENCE 455
#define SERIAL 456
#define SETOF 457
#define SHOW 458
#define START 459
#define STATEMENT 460
#define STDIN 461
#define STDOUT 462
#define TRUSTED 463
#define UNLISTEN 464
#define UNTIL 465
#define VACUUM 466
#define VALID 467
#define VERBOSE 468
#define VERSION 469
#define IDENT 470
#define SCONST 471
#define Op 472
#define ICONST 473
#define PARAM 474
#define FCONST 475
#define OP 476
#define UMINUS 477
#define TYPECAST 478
#define LIMIT 431
#define LISTEN 432
#define LOAD 433
#define LOCATION 434
#define LOCK_P 435
#define MAXVALUE 436
#define MINVALUE 437
#define MOVE 438
#define NEW 439
#define NOCREATEDB 440
#define NOCREATEUSER 441
#define NONE 442
#define NOTHING 443
#define NOTIFY 444
#define NOTNULL 445
#define OFFSET 446
#define OIDS 447
#define OPERATOR 448
#define PASSWORD 449
#define PROCEDURAL 450
#define RECIPE 451
#define RENAME 452
#define RESET 453
#define RETURNS 454
#define ROW 455
#define RULE 456
#define SEQUENCE 457
#define SERIAL 458
#define SETOF 459
#define SHOW 460
#define START 461
#define STATEMENT 462
#define STDIN 463
#define STDOUT 464
#define TRUSTED 465
#define UNLISTEN 466
#define UNTIL 467
#define VACUUM 468
#define VALID 469
#define VERBOSE 470
#define VERSION 471
#define IDENT 472
#define SCONST 473
#define Op 474
#define ICONST 475
#define PARAM 476
#define FCONST 477
#define OP 478
#define UMINUS 479
#define TYPECAST 480
extern YYSTYPE yylval;