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

Commit0730e20

Browse files
author
Maxim Orlov
committed
Issue#27: Add fix for Travis Ci failed tests.
1 parentd90fd21 commit0730e20

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

‎pg_variables.c

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ typedef struct tagHtabToStat {
152152
HASH_SEQ_STATUS*status;
153153
Variable*variable;
154154
Package*package;
155+
intlevel;
155156
}HtabToStat;
156157

157158
/*
@@ -181,6 +182,12 @@ HtabToStat_eq_all(HtabToStat *entry, void *value)
181182
return true;
182183
}
183184

185+
staticbool
186+
HtabToStat_level_eq(HtabToStat*entry,void*value)
187+
{
188+
returnentry->level==*(int*)value;
189+
}
190+
184191
/*
185192
* Generic remove_if algorithm for HtabToStat.
186193
*
@@ -192,6 +199,7 @@ HtabToStat_remove_if(List **l, void *value,
192199
bool (*eq)(HtabToStat*,void*),
193200
boolmatch_first)
194201
{
202+
#if (PG_VERSION_NUM<130000)
195203
ListCell*cell,*next,*prev=NULL;
196204
HtabToStat*entry=NULL;
197205

@@ -214,6 +222,23 @@ HtabToStat_remove_if(List **l, void *value,
214222
prev=cell;
215223
}
216224
}
225+
#else
226+
/*
227+
* See https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=1cff1b95ab6ddae32faa3efe0d95a820dbfdc164
228+
*
229+
* Version > 13 have different lists interface.
230+
*/
231+
ListCell*cell;
232+
HtabToStat*entry=NULL;
233+
234+
foreach(cell,*l)
235+
{
236+
entry= (HtabToStat*)lfirst(cell);
237+
238+
if (eq(entry,value))
239+
*l=foreach_delete_current(*l,cell);
240+
}
241+
#endif
217242
}
218243

219244
/*
@@ -243,6 +268,15 @@ remove_variables_package(List **l, Package *package)
243268
HtabToStat_remove_if(l,package,HtabToStat_package_eq, false);
244269
}
245270

271+
/*
272+
* Remove all the entrys for level.
273+
*/
274+
staticvoid
275+
remove_variables_level(List**l,intlevel)
276+
{
277+
HtabToStat_remove_if(l,&level,HtabToStat_level_eq, false);
278+
}
279+
246280
/*
247281
* Remove all.
248282
*/
@@ -757,6 +791,7 @@ variable_select(PG_FUNCTION_ARGS)
757791
htab_to_stat->status=rstat;
758792
htab_to_stat->variable=variable;
759793
htab_to_stat->package=package;
794+
htab_to_stat->level=GetCurrentTransactionNestLevel();
760795
variables_stats=lcons((void*)htab_to_stat,variables_stats);
761796

762797
MemoryContextSwitchTo(oldcontext);
@@ -1356,7 +1391,6 @@ get_packages_stats(PG_FUNCTION_ARGS)
13561391
{
13571392
TupleDesctupdesc;
13581393

1359-
//elog(INFO, " >>> ");
13601394
funcctx=SRF_FIRSTCALL_INIT();
13611395
oldcontext=MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
13621396

@@ -1432,7 +1466,7 @@ get_packages_stats(PG_FUNCTION_ARGS)
14321466
else
14331467
{
14341468
packages_stats=list_delete(packages_stats,rstat);
1435-
//pfree(rstat);
1469+
pfree(rstat);
14361470
SRF_RETURN_DONE(funcctx);
14371471
}
14381472
}
@@ -2312,6 +2346,8 @@ pgvSubTransCallback(SubXactEvent event, SubTransactionId mySubid,
23122346
break;
23132347
}
23142348
}
2349+
2350+
remove_variables_level(&variables_stats,GetCurrentTransactionNestLevel());
23152351
}
23162352

23172353
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp