Repository navigation
compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build) - #1448
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR separates upstream-compatible tuple-descriptor and executor APIs from explicit ROWID-aware variants, then updates bootstrap, catalog, executor, aggregate, portal, and plan-cache call sites to use the appropriate entry points. ChangesAPI compatibility and ROWID-aware call sites
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/include/access/tupdesc.h (1)
216-218: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a dummy argument to strictly comply with ISO C99 variadic macros.
The comments explicitly state "Standard ISO C99 variadic-macro idiom; no GNU extensions", but these macros violate C99 section 6.10.3p4 when the minimum number of arguments is passed. In strict C99, the
...parameter in the_Nmacros must be matched by at least one argument. Passing exactly the number of named parameters results in an empty...argument, which triggers compiler warnings under-pedantic(e.g.,warning: ISO C99 requires rest arguments to be used). Appending a dummy argument (such as, 0) to the_Rmacros safely anchors the ellipsis, completing the intended strict, warning-free ISO C99 compliance without affecting the selected macro suffixN.
src/include/access/tupdesc.h#L216-L218: append, 0to the expansion:ivorysql_createTupleDesc_N(__VA_ARGS__, 4, 3, 2, 0)src/include/executor/executor.h#L651-L653: append, 0to the expansion:ivorysql_execTypeFromTL_N(__VA_ARGS__, 2, 1, 0)src/include/executor/executor.h#L655-L657: append, 0to the expansion:ivorysql_execCleanTypeFromTL_N(__VA_ARGS__, 2, 1, 0)src/include/executor/executor.h#L665-L667: append, 0to the expansion:ivorysql_execInitJunkFilter_N(__VA_ARGS__, 3, 2, 0)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/include/access/tupdesc.h` around lines 216 - 218, The variadic dispatch macros must always provide a dummy argument to the ellipsis for strict ISO C99 compliance. Update ivorysql_createTupleDesc_R in src/include/access/tupdesc.h:216-218, ivorysql_execTypeFromTL_R in src/include/executor/executor.h:651-653, ivorysql_execCleanTypeFromTL_R in src/include/executor/executor.h:655-657, and ivorysql_execInitJunkFilter_R in src/include/executor/executor.h:665-667 to append the dummy argument after the existing selector values, preserving the selected macro suffix and call behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/include/access/tupdesc.h`:
- Around line 216-218: The variadic dispatch macros must always provide a dummy
argument to the ellipsis for strict ISO C99 compliance. Update
ivorysql_createTupleDesc_R in src/include/access/tupdesc.h:216-218,
ivorysql_execTypeFromTL_R in src/include/executor/executor.h:651-653,
ivorysql_execCleanTypeFromTL_R in src/include/executor/executor.h:655-657, and
ivorysql_execInitJunkFilter_R in src/include/executor/executor.h:665-667 to
append the dummy argument after the existing selector values, preserving the
selected macro suffix and call behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4a0a3a9e-4fc9-4df1-90ec-d2abb0b086c8
📒 Files selected for processing (5)
src/backend/access/common/tupdesc.csrc/backend/executor/execJunk.csrc/backend/executor/execTuples.csrc/include/access/tupdesc.hsrc/include/executor/executor.h
Address CodeRabbit nitpick on IvorySQL#1448: the dispatcher macros claimed ISO C99 compliance but, with the minimum argument count passed, the ellipsis of the _N helper was empty, triggering warning: ISO C99 requires at least one argument for the "..." in a variadic macro under -std=c99 -pedantic (ISO C99 6.10.3p4). Append a dummy `, 0` argument to each _R macro so the ellipsis is always non-empty. The selected numeric suffix N is unchanged, so call routing is identical. Verified: -std=c99 -pedantic on the compat probe and on all internal call sites now produces no variadic-macro warnings (remaining -pedantic noise is pre-existing PG-wide typedef/__int128). Signed-off-by: Yue Wang <[email protected]>
|
I will take a look, thanks. |
|
A plain rename of 18 internal callers would achieve the same goal with far less preprocessor magic, why not? |
|
Good points, both. You're right on the ABI breakage: by replacing the I'll rework this to approach B: keep the upstream signatures and symbol names untouched ( Will push the rework to this PR once ready. |
…names Reworked per reviewer feedback (bigplaice on IvorySQL#1448): the previous approach (argument-count dispatcher macros) fixed source compatibility but replaced the upstream symbols with underscore-suffixed variants, which (a) broke ABI for pre-compiled extensions expecting the upstream symbol under the bare name, and (b) introduced preprocessor complexity. This change restores the upstream PostgreSQL signatures and symbols exactly, and exposes the IvorySQL rowid-aware variants under new `*WithRowId` names. The upstream entry points forward with hasrowid=false / tdhasrowid=false / is_sysattr=false, matching upstream semantics. Internal callers that need rowid control are updated to call the WithRowId variants (18 call sites across 14 files). ExecTypeFromTL(List *) -- upstream, preserved ExecTypeFromTLWithRowId(List *, bool hasrowid) -- IvorySQL ExecCleanTypeFromTL(List *) -- upstream, preserved ExecCleanTypeFromTLWithRowId(List *, bool hasrowid) ExecInitJunkFilter(List *, TupleTableSlot *) -- upstream, preserved ExecInitJunkFilterWithRowId(List *, bool hasrowid, TupleTableSlot *) CreateTupleDesc(int, Form_pg_attribute *) -- upstream, preserved CreateTupleDescWithRowId(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr) Result: * No preprocessor macros anywhere. * Upstream symbols (ExecTypeFromTL etc.) remain real exported functions, so both source-level and ABI compatibility hold for extensions written against standard PostgreSQL. mysql_fdw compiles unchanged. * make -C src/backend builds clean with zero new warnings; -std=c99 -pedantic produces no warnings related to this change. * Symbols verified present in the resulting object files: T ExecTypeFromTL / T ExecTypeFromTLWithRowId (and the same pattern for the other three APIs). Fixes IvorySQL#1379 Signed-off-by: Yue Wang <[email protected]>
38def85 to
9ad45e7
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/backend/bootstrap/bootparse.y (1)
180-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winPrefer upstream-compatible wrappers over explicit
*WithRowIdcalls passingfalse.These call sites explicitly invoke the
*WithRowIdvariants while passing hardcodedfalseflags for rowid operations. The PR objectives emphasize preserving upstream signatures and symbol names; utilizing the new upstream-compatible wrappers here fulfills that objective and avoids unnecessary divergence from the upstream PostgreSQL codebase, which helps prevent future merge conflicts.Consider applying the corresponding wrappers at these locations:
src/backend/bootstrap/bootparse.y#L180-L180: replace withCreateTupleDesc(numattr, attrtypes);src/backend/bootstrap/bootstrap.c#L652-L652: replace withCreateTupleDesc(numattr, attrtypes);src/backend/executor/functions.c#L833-L833: replace withExecInitJunkFilter(resulttlist, slot);src/backend/tcop/pquery.c#L673-L673: replace withExecCleanTypeFromTL(pstmt->planTree->targetlist);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/backend/bootstrap/bootparse.y` at line 180, Replace the explicit WithRowId calls that pass false with the upstream-compatible wrappers: update CreateTupleDescWithRowId in src/backend/bootstrap/bootparse.y:180 and src/backend/bootstrap/bootstrap.c:652 to CreateTupleDesc, ExecInitJunkFilterWithRowId in src/backend/executor/functions.c:833 to ExecInitJunkFilter, and ExecCleanTypeFromTLWithRowId in src/backend/tcop/pquery.c:673 to ExecCleanTypeFromTL.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/backend/bootstrap/bootparse.y`:
- Line 180: Replace the explicit WithRowId calls that pass false with the
upstream-compatible wrappers: update CreateTupleDescWithRowId in
src/backend/bootstrap/bootparse.y:180 and src/backend/bootstrap/bootstrap.c:652
to CreateTupleDesc, ExecInitJunkFilterWithRowId in
src/backend/executor/functions.c:833 to ExecInitJunkFilter, and
ExecCleanTypeFromTLWithRowId in src/backend/tcop/pquery.c:673 to
ExecCleanTypeFromTL.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c4285252-f005-4f0e-b509-582230d4624a
📒 Files selected for processing (19)
src/backend/access/common/tupdesc.csrc/backend/bootstrap/bootparse.ysrc/backend/bootstrap/bootstrap.csrc/backend/catalog/heap.csrc/backend/executor/execExpr.csrc/backend/executor/execJunk.csrc/backend/executor/execMain.csrc/backend/executor/execTuples.csrc/backend/executor/functions.csrc/backend/executor/nodeAgg.csrc/backend/executor/nodeCustom.csrc/backend/executor/nodeForeignscan.csrc/backend/executor/nodeIndexonlyscan.csrc/backend/executor/nodeSubplan.csrc/backend/tcop/pquery.csrc/backend/utils/adt/orderedsetaggs.csrc/backend/utils/cache/plancache.csrc/include/access/tupdesc.hsrc/include/executor/executor.h
|
LGTM. |
|
Thanks for all your work! The problem is solved. |
|
Thanks @hanjianqiao! CI is green on the latest push. Ready to merge whenever you have a moment — no rush. |
|
@123123213weqw Hi, please solve the conflict so that it can be merged. |
9ad45e7 to
32a0f6d
Compare
…names Reworked per reviewer feedback (bigplaice on IvorySQL#1448): the previous approach (argument-count dispatcher macros) fixed source compatibility but replaced the upstream symbols with underscore-suffixed variants, which (a) broke ABI for pre-compiled extensions expecting the upstream symbol under the bare name, and (b) introduced preprocessor complexity. This change restores the upstream PostgreSQL signatures and symbols exactly, and exposes the IvorySQL rowid-aware variants under new `*WithRowId` names. The upstream entry points forward with hasrowid=false / tdhasrowid=false / is_sysattr=false, matching upstream semantics. Internal callers that need rowid control are updated to call the WithRowId variants (18 call sites across 14 files). ExecTypeFromTL(List *) -- upstream, preserved ExecTypeFromTLWithRowId(List *, bool hasrowid) -- IvorySQL ExecCleanTypeFromTL(List *) -- upstream, preserved ExecCleanTypeFromTLWithRowId(List *, bool hasrowid) ExecInitJunkFilter(List *, TupleTableSlot *) -- upstream, preserved ExecInitJunkFilterWithRowId(List *, bool hasrowid, TupleTableSlot *) CreateTupleDesc(int, Form_pg_attribute *) -- upstream, preserved CreateTupleDescWithRowId(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr) Result: * No preprocessor macros anywhere. * Upstream symbols (ExecTypeFromTL etc.) remain real exported functions, so both source-level and ABI compatibility hold for extensions written against standard PostgreSQL. mysql_fdw compiles unchanged. * make -C src/backend builds clean with zero new warnings; -std=c99 -pedantic produces no warnings related to this change. * Symbols verified present in the resulting object files: T ExecTypeFromTL / T ExecTypeFromTLWithRowId (and the same pattern for the other three APIs). Fixes IvorySQL#1379
…names Reworked per reviewer feedback (bigplaice on IvorySQL#1448): the previous approach (argument-count dispatcher macros) fixed source compatibility but replaced the upstream symbols with underscore-suffixed variants, which (a) broke ABI for pre-compiled extensions expecting the upstream symbol under the bare name, and (b) introduced preprocessor complexity. This change restores the upstream PostgreSQL signatures and symbols exactly, and exposes the IvorySQL rowid-aware variants under new `*WithRowId` names. The upstream entry points forward with hasrowid=false / tdhasrowid=false / is_sysattr=false, matching upstream semantics. Internal callers that need rowid control are updated to call the WithRowId variants (18 call sites across 14 files). ExecTypeFromTL(List *) -- upstream, preserved ExecTypeFromTLWithRowId(List *, bool hasrowid) -- IvorySQL ExecCleanTypeFromTL(List *) -- upstream, preserved ExecCleanTypeFromTLWithRowId(List *, bool hasrowid) ExecInitJunkFilter(List *, TupleTableSlot *) -- upstream, preserved ExecInitJunkFilterWithRowId(List *, bool hasrowid, TupleTableSlot *) CreateTupleDesc(int, Form_pg_attribute *) -- upstream, preserved CreateTupleDescWithRowId(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr) Result: * No preprocessor macros anywhere. * Upstream symbols (ExecTypeFromTL etc.) remain real exported functions, so both source-level and ABI compatibility hold for extensions written against standard PostgreSQL. mysql_fdw compiles unchanged. * make -C src/backend builds clean with zero new warnings; -std=c99 -pedantic produces no warnings related to this change. * Symbols verified present in the resulting object files: T ExecTypeFromTL / T ExecTypeFromTLWithRowId (and the same pattern for the other three APIs). Fixes IvorySQL#1379
32a0f6d to
ea6dbca
Compare
…names Reworked per reviewer feedback (bigplaice on IvorySQL#1448): the previous approach (argument-count dispatcher macros) fixed source compatibility but replaced the upstream symbols with underscore-suffixed variants, which (a) broke ABI for pre-compiled extensions expecting the upstream symbol under the bare name, and (b) introduced preprocessor complexity. This change restores the upstream PostgreSQL signatures and symbols exactly, and exposes the IvorySQL rowid-aware variants under new `*WithRowId` names. The upstream entry points forward with hasrowid=false / tdhasrowid=false / is_sysattr=false, matching upstream semantics. Internal callers that need rowid control are updated to call the WithRowId variants (18 call sites across 14 files). ExecTypeFromTL(List *) -- upstream, preserved ExecTypeFromTLWithRowId(List *, bool hasrowid) -- IvorySQL ExecCleanTypeFromTL(List *) -- upstream, preserved ExecCleanTypeFromTLWithRowId(List *, bool hasrowid) ExecInitJunkFilter(List *, TupleTableSlot *) -- upstream, preserved ExecInitJunkFilterWithRowId(List *, bool hasrowid, TupleTableSlot *) CreateTupleDesc(int, Form_pg_attribute *) -- upstream, preserved CreateTupleDescWithRowId(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr) Result: * No preprocessor macros anywhere. * Upstream symbols (ExecTypeFromTL etc.) remain real exported functions, so both source-level and ABI compatibility hold for extensions written against standard PostgreSQL. mysql_fdw compiles unchanged. * make -C src/backend builds clean with zero new warnings; -std=c99 -pedantic produces no warnings related to this change. * Symbols verified present in the resulting object files: T ExecTypeFromTL / T ExecTypeFromTLWithRowId (and the same pattern for the other three APIs). Fixes IvorySQL#1379
ea6dbca to
a23e573
Compare
|
CI failure fixed in Validated locally with the CI |
done |
…ext-compat-shim compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build) (cherry picked from commit 39f94b0)
…ext-compat-shim compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build) (cherry picked from commit 39f94b0)
Problem
IvorySQL modifies four public PostgreSQL executor/tuple-descriptor APIs in place to add Oracle rowid support, breaking source compatibility for extensions written against standard PostgreSQL:
ExecTypeFromTL(List *)(List *, bool hasrowid)ExecCleanTypeFromTL(List *)(List *, bool hasrowid)ExecInitJunkFilter(List *, TupleTableSlot *)(List *, bool hasrowid, TupleTableSlot *)CreateTupleDesc(int, Form_pg_attribute *)(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr)mysql_fdwfails to compile becausemysql_fdw.c:613calls the upstream one-argument form (ExecTypeFromTL(scan_tlist)), reported in #1379.Fix
Restore the upstream signatures and symbols exactly, and expose the IvorySQL rowid-aware variants under new
*WithRowIdnames. Internal call sites that passhasrowid(18 sites across 14 files) are updated to call the WithRowId variants.ExecTypeFromTL(List *)ExecTypeFromTLWithRowId(List *, bool hasrowid)ExecCleanTypeFromTL(List *)ExecCleanTypeFromTLWithRowId(List *, bool hasrowid)ExecInitJunkFilter(List *, TupleTableSlot *)ExecInitJunkFilterWithRowId(List *, bool hasrowid, TupleTableSlot *)CreateTupleDesc(int, Form_pg_attribute *)CreateTupleDescWithRowId(int, Form_pg_attribute *, bool tdhasrowid, bool is_sysattr)Extensions written against upstream PostgreSQL continue to compile and link unchanged — both source-level and ABI compatibility hold, because
ExecTypeFromTLetc. remain real exported functions with their original signatures.Why this approach (vs. the earlier macro dispatcher)
The first iteration of this PR used argument-count dispatcher macros to route calls based on arity. Reviewer @bigplaice pointed out two issues:
ExecTypeFromTLsymbol with_1/_2variants breaks pre-compiled extensions that expect the upstream symbol under the bare name.This rework drops all macros and restores the upstream symbols as real functions. (See PR comment.)
Verification
make -C src/backendbuilds clean with zero new warnings.-std=c99 -pedantic -Wallon a probe exercising all eight call combinations (4 upstream + 4 WithRowId) produces no warnings related to this change (no macros → no variadic-macro concerns).nm:Fixes #1379
Summary by CodeRabbit