# HG changeset patch # User Olaf Wintermann # Date 1660834497 -7200 # Node ID 4e2cb3adc0f2cdff3b36cbae8f3dafb91e2dd1e7 # Parent 0344108db2557b1b2d24e0f0faea513277135084 pg_vfs_open stores the resource_id in rq->vars diff -r 0344108db255 -r 4e2cb3adc0f2 src/server/plugins/postgresql/vfs.c --- a/src/server/plugins/postgresql/vfs.c Thu Aug 18 16:48:23 2022 +0200 +++ b/src/server/plugins/postgresql/vfs.c Thu Aug 18 16:54:57 2022 +0200 @@ -32,6 +32,7 @@ #include #include "../../util/util.h" +#include "../../util/pblock.h" static VFS pg_vfs_class = { pg_vfs_open, @@ -615,6 +616,19 @@ } } + // store the resource_id in rq->vars + if(ctx->rq) { + char *rq_path = pblock_findkeyval(pb_key_path, ctx->rq->vars); + if(rq_path && !strcmp(rq_path, path)) { + char *res_id_str = pblock_findval("resource_id", ctx->rq->vars); + if(!res_id_str) { + char resource_id_str[32]; + snprintf(resource_id_str, 32, "%" PRId64, resource_id); + pblock_nvinsert("resource_id",resource_id_str, ctx->rq->vars); + } + } + } + VFSFile *file = pool_malloc(ctx->pool, sizeof(VFSFile)); if(!file) { return NULL;