mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Abstract logic to allow for multiple kinds of child rels.
Currently, the only type of child relation is an "other member rel", which is the child of a baserel, but in the future joins and even upper relations may have child rels. To facilitate that, introduce macros that test to test for particular RelOptKind values, and use them in various places where they help to clarify the sense of a test. (For example, a test may allow RELOPT_OTHER_MEMBER_REL either because it intends to allow child rels, or because it intends to allow simple rels.) Also, remove find_childrel_top_parent, which will not work for a child rel that is not a baserel. Instead, add a new RelOptInfo member top_parent_relids to track the same kind of information in a more generic manner. Ashutosh Bapat, slightly tweaked by me. Review and testing of the patch set from which this was taken by Rajkumar Raghuwanshi and Rafia Sabih. Discussion: http://postgr.es/m/CA+TgmoagTnF2yqR3PT2rv=om=wJiZ4-A+ATwdnriTGku1CLYxA@mail.gmail.com
This commit is contained in:
		@@ -484,6 +484,23 @@ typedef enum RelOptKind
 | 
			
		||||
	RELOPT_DEADREL
 | 
			
		||||
} RelOptKind;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Is the given relation a simple relation i.e a base or "other" member
 | 
			
		||||
 * relation?
 | 
			
		||||
 */
 | 
			
		||||
#define IS_SIMPLE_REL(rel) \
 | 
			
		||||
	((rel)->reloptkind == RELOPT_BASEREL || \
 | 
			
		||||
	 (rel)->reloptkind == RELOPT_OTHER_MEMBER_REL)
 | 
			
		||||
 | 
			
		||||
/* Is the given relation a join relation? */
 | 
			
		||||
#define IS_JOIN_REL(rel) ((rel)->reloptkind == RELOPT_JOINREL)
 | 
			
		||||
 | 
			
		||||
/* Is the given relation an upper relation? */
 | 
			
		||||
#define IS_UPPER_REL(rel) ((rel)->reloptkind == RELOPT_UPPER_REL)
 | 
			
		||||
 | 
			
		||||
/* Is the given relation an "other" relation? */
 | 
			
		||||
#define IS_OTHER_REL(rel) ((rel)->reloptkind == RELOPT_OTHER_MEMBER_REL)
 | 
			
		||||
 | 
			
		||||
typedef struct RelOptInfo
 | 
			
		||||
{
 | 
			
		||||
	NodeTag		type;
 | 
			
		||||
@@ -554,6 +571,9 @@ typedef struct RelOptInfo
 | 
			
		||||
	List	   *joininfo;		/* RestrictInfo structures for join clauses
 | 
			
		||||
								 * involving this rel */
 | 
			
		||||
	bool		has_eclass_joins;		/* T means joininfo is incomplete */
 | 
			
		||||
 | 
			
		||||
	/* used by "other" relations. */
 | 
			
		||||
	Relids		top_parent_relids;		/* Relids of topmost parents. */
 | 
			
		||||
} RelOptInfo;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user