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

Commit6187a4e

Browse files
author
Maksim Milyutin
committed
Put missing in pg10 functions into pg_compat
1 parent42ce25b commit6187a4e

File tree

4 files changed

+119
-64
lines changed

4 files changed

+119
-64
lines changed

‎src/compat/pg_compat.c

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,79 @@ ExprDoneCond isDone;
213213
#endif
214214

215215

216+
/*
217+
* get_all_actual_clauses
218+
*/
219+
#ifPG_VERSION_NUM >=100000
220+
List*
221+
get_all_actual_clauses(List*restrictinfo_list)
222+
{
223+
List*result=NIL;
224+
ListCell*l;
225+
226+
foreach(l,restrictinfo_list)
227+
{
228+
RestrictInfo*rinfo= (RestrictInfo*)lfirst(l);
229+
230+
Assert(IsA(rinfo,RestrictInfo));
231+
232+
result=lappend(result,rinfo->clause);
233+
}
234+
returnresult;
235+
}
236+
#endif
237+
238+
239+
/*
240+
* make_restrictinfos_from_actual_clauses
241+
*/
242+
#ifPG_VERSION_NUM >=100000
243+
#include"optimizer/restrictinfo.h"
244+
#include"optimizer/var.h"
245+
246+
List*
247+
make_restrictinfos_from_actual_clauses(PlannerInfo*root,
248+
List*clause_list)
249+
{
250+
List*result=NIL;
251+
ListCell*l;
252+
253+
foreach(l,clause_list)
254+
{
255+
Expr*clause= (Expr*)lfirst(l);
256+
boolpseudoconstant;
257+
RestrictInfo*rinfo;
258+
259+
/*
260+
* It's pseudoconstant if it contains no Vars and no volatile
261+
* functions. We probably can't see any sublinks here, so
262+
* contain_var_clause() would likely be enough, but for safety use
263+
* contain_vars_of_level() instead.
264+
*/
265+
pseudoconstant=
266+
!contain_vars_of_level((Node*)clause,0)&&
267+
!contain_volatile_functions((Node*)clause);
268+
if (pseudoconstant)
269+
{
270+
/* tell createplan.c to check for gating quals */
271+
root->hasPseudoConstantQuals= true;
272+
}
273+
274+
rinfo=make_restrictinfo(clause,
275+
true,
276+
false,
277+
pseudoconstant,
278+
root->qual_security_level,
279+
NULL,
280+
NULL,
281+
NULL);
282+
result=lappend(result,rinfo);
283+
}
284+
returnresult;
285+
}
286+
#endif
287+
288+
216289
/*
217290
* make_result
218291
* Build a Result plan node

‎src/include/compat/pg_compat.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ not_signle_result_handler()
270270
#endif
271271

272272

273+
/*
274+
* get_all_actual_clauses()
275+
*/
276+
#ifPG_VERSION_NUM >=100000
277+
externList*get_all_actual_clauses(List*restrictinfo_list);
278+
#endif
279+
280+
273281
/*
274282
* get_parameterized_joinrel_size()
275283
*/
@@ -335,6 +343,15 @@ char get_rel_persistence(Oid relid);
335343
#endif
336344

337345

346+
/*
347+
* make_restrictinfo()
348+
*/
349+
#ifPG_VERSION_NUM >=100000
350+
externList*make_restrictinfos_from_actual_clauses(PlannerInfo*root,
351+
List*clause_list);
352+
#endif
353+
354+
338355
/*
339356
* make_result()
340357
*/

‎src/partition_creation.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ create_single_partition_internal(Oid parent_relid,
686686

687687
/* Elements of the "CREATE TABLE" query tree */
688688
RangeVar*parent_rv;
689+
TableLikeClauselike_clause;
690+
CreateStmtcreate_stmt;
689691
List*create_stmts;
690692
ListCell*lc;
691693

@@ -739,9 +741,34 @@ create_single_partition_internal(Oid parent_relid,
739741
if (!tablespace)
740742
tablespace=get_tablespace_name(get_rel_tablespace(parent_relid));
741743

744+
/* Initialize TableLikeClause structure */
745+
NodeSetTag(&like_clause,T_TableLikeClause);
746+
like_clause.relation=copyObject(parent_rv);
747+
like_clause.options=CREATE_TABLE_LIKE_DEFAULTS |
748+
CREATE_TABLE_LIKE_INDEXES |
749+
CREATE_TABLE_LIKE_STORAGE;
750+
751+
/* Initialize CreateStmt structure */
752+
NodeSetTag(&create_stmt,T_CreateStmt);
753+
create_stmt.relation=copyObject(partition_rv);
754+
create_stmt.tableElts=list_make1(copyObject(&like_clause));
755+
create_stmt.inhRelations=list_make1(copyObject(parent_rv));
756+
create_stmt.ofTypename=NULL;
757+
create_stmt.constraints=NIL;
758+
create_stmt.options=NIL;
759+
create_stmt.oncommit=ONCOMMIT_NOOP;
760+
create_stmt.tablespacename=tablespace;
761+
create_stmt.if_not_exists= false;
762+
#if defined(PGPRO_EE)&&PG_VERSION_NUM >=90600
763+
create_stmt.partition_info=NULL;
764+
#endif
765+
#ifPG_VERSION_NUM >=100000
766+
create_stmt.partbound=NULL;
767+
create_stmt.partspec=NULL;
768+
#endif
769+
742770
/* Obtain the sequence of Stmts to create partition and link it to parent */
743-
create_stmts=init_createstmts_for_partition(parent_rv,partition_rv,
744-
tablespace);
771+
create_stmts=transformCreateStmt(&create_stmt,NULL);
745772

746773
/* Create the partition and all required relations */
747774
foreach (lc,create_stmts)

‎src/pg_pathman.c

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -232,68 +232,6 @@ get_pathman_config_params_relid(bool invalid_is_ok)
232232
* ----------------------------------------
233233
*/
234234

235-
#ifPG_VERSION_NUM >=100000
236-
staticList*
237-
get_all_actual_clauses(List*restrictinfo_list)
238-
{
239-
List*result=NIL;
240-
ListCell*l;
241-
242-
foreach(l,restrictinfo_list)
243-
{
244-
RestrictInfo*rinfo= (RestrictInfo*)lfirst(l);
245-
246-
Assert(IsA(rinfo,RestrictInfo));
247-
248-
result=lappend(result,rinfo->clause);
249-
}
250-
returnresult;
251-
}
252-
253-
#include"optimizer/var.h"
254-
255-
staticList*
256-
make_restrictinfos_from_actual_clauses(PlannerInfo*root,
257-
List*clause_list)
258-
{
259-
List*result=NIL;
260-
ListCell*l;
261-
262-
foreach(l,clause_list)
263-
{
264-
Expr*clause= (Expr*)lfirst(l);
265-
boolpseudoconstant;
266-
RestrictInfo*rinfo;
267-
268-
/*
269-
* It's pseudoconstant if it contains no Vars and no volatile
270-
* functions. We probably can't see any sublinks here, so
271-
* contain_var_clause() would likely be enough, but for safety use
272-
* contain_vars_of_level() instead.
273-
*/
274-
pseudoconstant=
275-
!contain_vars_of_level((Node*)clause,0)&&
276-
!contain_volatile_functions((Node*)clause);
277-
if (pseudoconstant)
278-
{
279-
/* tell createplan.c to check for gating quals */
280-
root->hasPseudoConstantQuals= true;
281-
}
282-
283-
rinfo=make_restrictinfo(clause,
284-
true,
285-
false,
286-
pseudoconstant,
287-
root->qual_security_level,
288-
NULL,
289-
NULL,
290-
NULL);
291-
result=lappend(result,rinfo);
292-
}
293-
returnresult;
294-
}
295-
#endif
296-
297235
/*
298236
* Creates child relation and adds it to root.
299237
* Returns child index in simple_rel_array.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp