mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Optimizer fix for samekeys.
This commit is contained in:
parent
fe35ffe7e0
commit
78511d8fe9
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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--
|
* samekeys--
|
||||||
* Returns t iff two sets of path keys are equivalent. They are
|
* Returns t iff two sets of path keys are equivalent. They are
|
||||||
* equivalent if the first subkey (var node) within each sublist of
|
* equivalent if the first Var nodes match the second Var nodes.
|
||||||
* list 'keys1' is contained within the corresponding sublist of 'keys2'.
|
|
||||||
*
|
*
|
||||||
* XXX It isn't necessary to check that each sublist exactly contain
|
* XXX It isn't necessary to check that each sublist exactly contain
|
||||||
* the same elements because if the routine that built these
|
* the same elements because if the routine that built these
|
||||||
* sublists together is correct, having one element in common
|
* sublists together is correct, having one element in common
|
||||||
* implies having all elements in common.
|
* implies having all elements in common.
|
||||||
|
* Huh? bjm
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
samekeys(List *keys1, List *keys2)
|
samekeys(List *keys1, List *keys2)
|
||||||
{
|
{
|
||||||
List *key1,
|
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))
|
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;
|
return false;
|
||||||
|
if (key1a != NIL)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now the result should be true if list keys2 has at least as many
|
/* 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.
|
* entries as keys1, ie, we did not fall off the end of keys2 first.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -202,54 +202,56 @@ typedef union
|
|||||||
#define INSTEAD 428
|
#define INSTEAD 428
|
||||||
#define ISNULL 429
|
#define ISNULL 429
|
||||||
#define LANCOMPILER 430
|
#define LANCOMPILER 430
|
||||||
#define LISTEN 431
|
#define LIMIT 431
|
||||||
#define LOAD 432
|
#define LISTEN 432
|
||||||
#define LOCATION 433
|
#define LOAD 433
|
||||||
#define LOCK_P 434
|
#define LOCATION 434
|
||||||
#define MAXVALUE 435
|
#define LOCK_P 435
|
||||||
#define MINVALUE 436
|
#define MAXVALUE 436
|
||||||
#define MOVE 437
|
#define MINVALUE 437
|
||||||
#define NEW 438
|
#define MOVE 438
|
||||||
#define NOCREATEDB 439
|
#define NEW 439
|
||||||
#define NOCREATEUSER 440
|
#define NOCREATEDB 440
|
||||||
#define NONE 441
|
#define NOCREATEUSER 441
|
||||||
#define NOTHING 442
|
#define NONE 442
|
||||||
#define NOTIFY 443
|
#define NOTHING 443
|
||||||
#define NOTNULL 444
|
#define NOTIFY 444
|
||||||
#define OIDS 445
|
#define NOTNULL 445
|
||||||
#define OPERATOR 446
|
#define OFFSET 446
|
||||||
#define PASSWORD 447
|
#define OIDS 447
|
||||||
#define PROCEDURAL 448
|
#define OPERATOR 448
|
||||||
#define RECIPE 449
|
#define PASSWORD 449
|
||||||
#define RENAME 450
|
#define PROCEDURAL 450
|
||||||
#define RESET 451
|
#define RECIPE 451
|
||||||
#define RETURNS 452
|
#define RENAME 452
|
||||||
#define ROW 453
|
#define RESET 453
|
||||||
#define RULE 454
|
#define RETURNS 454
|
||||||
#define SEQUENCE 455
|
#define ROW 455
|
||||||
#define SERIAL 456
|
#define RULE 456
|
||||||
#define SETOF 457
|
#define SEQUENCE 457
|
||||||
#define SHOW 458
|
#define SERIAL 458
|
||||||
#define START 459
|
#define SETOF 459
|
||||||
#define STATEMENT 460
|
#define SHOW 460
|
||||||
#define STDIN 461
|
#define START 461
|
||||||
#define STDOUT 462
|
#define STATEMENT 462
|
||||||
#define TRUSTED 463
|
#define STDIN 463
|
||||||
#define UNLISTEN 464
|
#define STDOUT 464
|
||||||
#define UNTIL 465
|
#define TRUSTED 465
|
||||||
#define VACUUM 466
|
#define UNLISTEN 466
|
||||||
#define VALID 467
|
#define UNTIL 467
|
||||||
#define VERBOSE 468
|
#define VACUUM 468
|
||||||
#define VERSION 469
|
#define VALID 469
|
||||||
#define IDENT 470
|
#define VERBOSE 470
|
||||||
#define SCONST 471
|
#define VERSION 471
|
||||||
#define Op 472
|
#define IDENT 472
|
||||||
#define ICONST 473
|
#define SCONST 473
|
||||||
#define PARAM 474
|
#define Op 474
|
||||||
#define FCONST 475
|
#define ICONST 475
|
||||||
#define OP 476
|
#define PARAM 476
|
||||||
#define UMINUS 477
|
#define FCONST 477
|
||||||
#define TYPECAST 478
|
#define OP 478
|
||||||
|
#define UMINUS 479
|
||||||
|
#define TYPECAST 480
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user