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

Commit1972eb4

Browse files
committed
compatibility fixes for backport to v11
1 parent7097d1e commit1972eb4

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

‎engine.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@
3333
#include"miscadmin.h"
3434
#include"port/pg_crc32c.h"
3535
#include"storage/copydir.h"
36+
#ifPG_VERSION_NUM >=120000
3637
#include"storage/md.h"
38+
#include"storage/sync.h"
39+
#endif
3740
#include"storage/reinit.h"
3841
#include"storage/smgr.h"
39-
#include"storage/sync.h"
4042
#include"utils/array.h"
4143
#include"utils/builtins.h"
4244
#include"utils/pg_lsn.h"

‎ptrack.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,19 @@
2929
#include<unistd.h>
3030
#include<sys/stat.h>
3131

32+
#ifPG_VERSION_NUM<120000
33+
#include"access/htup_details.h"
34+
#endif
3235
#include"catalog/pg_tablespace.h"
3336
#include"catalog/pg_type.h"
3437
#include"funcapi.h"
3538
#include"miscadmin.h"
3639
#include"nodes/pg_list.h"
3740
#include"storage/copydir.h"
3841
#include"storage/lmgr.h"
42+
#ifPG_VERSION_NUM >=120000
3943
#include"storage/md.h"
44+
#endif
4045
#include"storage/reinit.h"
4146
#include"utils/builtins.h"
4247
#include"utils/guc.h"
@@ -55,7 +60,9 @@ intptrack_map_size_tmp;
5560
staticcopydir_hook_typeprev_copydir_hook=NULL;
5661
staticmdwrite_hook_typeprev_mdwrite_hook=NULL;
5762
staticmdextend_hook_typeprev_mdextend_hook=NULL;
63+
#ifPG_VERSION_NUM >=120000
5864
staticProcessSyncRequests_hook_typeprev_ProcessSyncRequests_hook=NULL;
65+
#endif
5966

6067
void_PG_init(void);
6168
void_PG_fini(void);
@@ -65,8 +72,9 @@ static void ptrack_mdwrite_hook(RelFileNodeBackend smgr_rnode,
6572
ForkNumberforkno,BlockNumberblkno);
6673
staticvoidptrack_mdextend_hook(RelFileNodeBackendsmgr_rnode,
6774
ForkNumberforkno,BlockNumberblkno);
75+
#ifPG_VERSION_NUM >=120000
6876
staticvoidptrack_ProcessSyncRequests_hook(void);
69-
77+
#endif
7078
staticvoidptrack_gather_filelist(List**filelist,char*path,OidspcOid,OiddbOid);
7179
staticintptrack_filelist_getnext(PtScanCtx*ctx);
7280

@@ -108,8 +116,10 @@ _PG_init(void)
108116
mdwrite_hook=ptrack_mdwrite_hook;
109117
prev_mdextend_hook=mdextend_hook;
110118
mdextend_hook=ptrack_mdextend_hook;
119+
#ifPG_VERSION_NUM >=120000
111120
prev_ProcessSyncRequests_hook=ProcessSyncRequests_hook;
112121
ProcessSyncRequests_hook=ptrack_ProcessSyncRequests_hook;
122+
#endif
113123
}
114124

115125
/*
@@ -122,7 +132,9 @@ _PG_fini(void)
122132
copydir_hook=prev_copydir_hook;
123133
mdwrite_hook=prev_mdwrite_hook;
124134
mdextend_hook=prev_mdextend_hook;
135+
#ifPG_VERSION_NUM >=120000
125136
ProcessSyncRequests_hook=prev_ProcessSyncRequests_hook;
137+
#endif
126138
}
127139

128140
/*
@@ -194,6 +206,7 @@ ptrack_mdextend_hook(RelFileNodeBackend smgr_rnode,
194206
prev_mdextend_hook(smgr_rnode,forknum,blocknum);
195207
}
196208

209+
#ifPG_VERSION_NUM >=120000
197210
staticvoid
198211
ptrack_ProcessSyncRequests_hook()
199212
{
@@ -202,6 +215,7 @@ ptrack_ProcessSyncRequests_hook()
202215
if (prev_ProcessSyncRequests_hook)
203216
prev_ProcessSyncRequests_hook();
204217
}
218+
#endif
205219

206220
/*
207221
* Recursively walk through the path and add all data files to filelist.
@@ -426,7 +440,11 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
426440
ctx->filelist=NIL;
427441

428442
/* Make tuple descriptor */
443+
#ifPG_VERSION_NUM >=120000
429444
tupdesc=CreateTemplateTupleDesc(2);
445+
#else
446+
tupdesc=CreateTemplateTupleDesc(2, false);
447+
#endif
430448
TupleDescInitEntry(tupdesc, (AttrNumber)1,"path",TEXTOID,-1,0);
431449
TupleDescInitEntry(tupdesc, (AttrNumber)2,"pagemap",BYTEAOID,-1,0);
432450
funcctx->tuple_desc=BlessTupleDesc(tupdesc);
@@ -475,6 +493,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
475493
charpathname[MAXPGPATH];
476494
bytea*result=NULL;
477495
Sizeresult_sz=pagemap.bitmapsize+VARHDRSZ;
496+
HeapTuplehtup=NULL;
478497

479498
/* Create a bytea copy of our bitmap */
480499
result= (bytea*)palloc(result_sz);
@@ -490,7 +509,9 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
490509
pagemap.bitmap=NULL;
491510
pagemap.bitmapsize=0;
492511

493-
SRF_RETURN_NEXT(funcctx,HeapTupleGetDatum(heap_form_tuple(funcctx->tuple_desc,values,nulls)));
512+
htup=heap_form_tuple(funcctx->tuple_desc,values,nulls);
513+
if (htup)
514+
SRF_RETURN_NEXT(funcctx,HeapTupleGetDatum(htup));
494515
}
495516
else
496517
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp