nahanni / rw_redis_fdw

Other
96 stars 23 forks source link

PostgreSQL 14 support #18

Open devrimgunduz opened 3 years ago

devrimgunduz commented 3 years ago

Hi,

redis_fdw fails to build against PostgreSQL 14. Can you please take a look? v14 beta1 is out, and we are working on packaging.

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -DWRITE_API -g -I. -I./ -I/usr/pgsql-14/include/server -I/usr/pgsql-14/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o redis_fdw.o redis_fdw.c /usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -DWRITE_API -g -I. -I./ -I/usr/pgsql-14/include/server -I/usr/pgsql-14/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o redis_fdw.bc redis_fdw.c redis_fdw.c: In function 'redis_fdw_handler': redis_fdw.c:1099:42: warning: assignment to 'AddForeignUpdateTargets_function' {aka 'void ()(PlannerInfo , unsigned int, RangeTblEntry , struct RelationData )'} from incompatible pointer type 'void ()(Query , RangeTblEntry , struct RelationData )' [-Wincompatible-pointer-types] 1099 | routine->AddForeignUpdateTargets = redisAddForeignUpdateTargets; | ^ redis_fdw.c: In function 'redisBeginForeignModify': redis_fdw.c:3755:40: error: 'ModifyTableState' has no member named 'mt_plans' 3755 | Plan *subplan = mtstate->mt_plans[subplan_index]->plan; | ^~ redis_fdw.c: In function 'redis_parse_where': redis_fdw.c:1843:36: warning: this statement may fall through [-Wimplicit-fallthrough=] 1843 | if (rctx->table_type == PG_REDIS_LIST) { | ^ redis_fdw.c:1848:25: note: here 1848 | default: | ^~~ make[1]: [: redis_fdw.o] Error 1 make[1]: Waiting for unfinished jobs.... redis_fdw.c:1099:35: warning: incompatible function pointer types assigning to 'AddForeignUpdateTargets_function' (aka 'void ()(struct PlannerInfo , unsigned int, struct RangeTblEntry , struct RelationData )') from 'void (Query , RangeTblEntry , Relation)' (aka 'void (struct Query , struct RangeTblEntry , struct RelationData )') [-Wincompatible-function-pointer-types] routine->AddForeignUpdateTargets = redisAddForeignUpdateTargets; ^ ~~~~~~~~ redis_fdw.c:3755:28: error: no member named 'mt_plans' in 'struct ModifyTableState' Plan subplan = mtstate->mt_plans[subplan_index]->plan;


1 warning and 1 error generated.
make[1]: *** [/usr/pgsql-14/lib/pgxs/src/makefiles/../../src/Makefile.global:1051: redis_fdw.bc] Error 1
make[1]: Leaving directory '/home/devrim/Documents/Devrim/Projects/repo/pgrpms/rpm/redhat/master/non-common/redis_fdw/master/rw_redis_fdw-1.1'
devrimgunduz commented 3 years ago

Hi

Any updates?

Regards, Devrim

devrimgunduz commented 3 years ago

ping.

devrimgunduz commented 3 years ago

Anyone around? v14 is around the corner.

devrimgunduz commented 3 years ago

ping

devrimgunduz commented 3 years ago

ping

devrimgunduz commented 3 years ago

ping

devrimgunduz commented 3 years ago

ping.

dumbuzz commented 2 years ago

To support pg14 fix this in redis_fdw.c: 1) #include` "optimizer/appendinfo.h 2) static void redisAddForeignUpdateTargets(

if PG_VERSION_NUM < 140000

            Query *parsetree,

else

            PlannerInfo *root,
            Index rtindex,

endif

3) Var *var;

if PG_VERSION_NUM < 140000

TargetEntry *tle;

endif

4)

if PG_VERSION_NUM < 140000

/ make a Var representing the desired value / var = makeVar(parsetree->resultRelation, attrno, att->atttypid, att->atttypmod, att->attcollation, 0); / wrap it in a resjunk TLE / tle = makeTargetEntry((Expr *)var, list_length(parsetree->targetList) + 1, pstrdup(colname), true); parsetree->targetList = lappend(parsetree->targetList, tle);

else

var = makeVar(rtindex,
             attrno,
             att->atttypid,
             att->atttypmod,
             att->attcollation,
     0);
/* register it as a row-identity column needed by this target rel */
add_row_identity_var(root, var, rtindex, "__redis_mod_key_name");

endif

5)

if PG_VERSION_NUM < 140000

Plan *subplan = mtstate->mt_plans[subplan_index]->plan;

else

Plan *subplan = outerPlanState(mtstate)->plan;

endif

altair86 commented 2 years ago

I make only 5 and it works for me