Skip to content

compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build) - #1448

Merged
gaoxueyu merged 2 commits into
IvorySQL:masterfrom
123123213weqw:wangyue/fix-1379-ext-compat-shim
Jul 27, 2026
Merged

gaoxueyu merged 2 commits into
IvorySQL:masterfrom
123123213weqw:wangyue/fix-1379-ext-compat-shim

Conversation

@123123213weqw

@123123213weqw 123123213weqw commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

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:

API Upstream PostgreSQL (PG18) IvorySQL 5.4 (before)
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_fdw fails to compile because mysql_fdw.c:613 calls 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 *WithRowId names. Internal call sites that pass hasrowid (18 sites across 14 files) are updated to call the WithRowId variants.

Upstream entry point (preserved, hasrowid=false) IvorySQL variant
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 ExecTypeFromTL etc. 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:

  1. ABI breakage — replacing the ExecTypeFromTL symbol with _1/_2 variants breaks pre-compiled extensions that expect the upstream symbol under the bare name.
  2. Unnecessary preprocessor complexity — a plain rename of internal callers achieves the same source-compat goal more cleanly.

This rework drops all macros and restores the upstream symbols as real functions. (See PR comment.)

Verification

  • make -C src/backend builds clean with zero new warnings.
  • -std=c99 -pedantic -Wall on a probe exercising all eight call combinations (4 upstream + 4 WithRowId) produces no warnings related to this change (no macros → no variadic-macro concerns).
  • Symbols verified present in object files via nm:
    T ExecTypeFromTL            T ExecTypeFromTLWithRowId
    T ExecCleanTypeFromTL       T ExecCleanTypeFromTLWithRowId
    T ExecInitJunkFilter        T ExecInitJunkFilterWithRowId
    T CreateTupleDesc           T CreateTupleDescWithRowId
    
    The upstream symbols are real global functions, so pre-compiled extensions also resolve correctly.

Fixes #1379

Summary by CodeRabbit

  • Compatibility
    • Restored upstream-compatible calling conventions for tuple-descriptor creation and executor helpers, while retaining RowId-aware behavior via dedicated “WithRowId” APIs.
    • Updated tuple-type construction throughout planning/execution (including cleaned tuple types and junk-filter initialization) to consistently include or omit RowId as appropriate.
    • Adjusted tuple-descriptor usage for relation creation, system-attribute handling, and portal/result descriptors to align RowId expectations end-to-end.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The 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.

Changes

API compatibility and ROWID-aware call sites

Layer / File(s) Summary
Tuple descriptor API split
src/include/access/tupdesc.h, src/backend/access/common/tupdesc.c, src/backend/bootstrap/*, src/backend/catalog/heap.c
Adds two-argument CreateTupleDesc and renames the four-argument implementation to CreateTupleDescWithRowId; bootstrap and catalog construction use the explicit variant.
Executor API split
src/include/executor/executor.h, src/backend/executor/execJunk.c, src/backend/executor/execTuples.c
Adds upstream-compatible wrappers and separate WithRowId variants for junk-filter and target-list tuple-descriptor initialization.
ROWID-aware executor call sites
src/backend/executor/*, src/backend/tcop/pquery.c, src/backend/utils/{adt,cache}/*, src/pl/plisql/src/pl_package.c
Updates scan, subplan, aggregate, portal, function, whole-row, and plan-cache paths to call the explicit ROWID-aware helpers where required; also makes an internal PL/ISQL helper signature explicit.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: jiaoshuntian

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes support the API split, but the pl_package.c void-parameter cleanup is unrelated to the linked compatibility fix. Remove the unrelated pl_package.c signature-only cleanup from this PR, or document why it is required for the compatibility fix.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main compatibility fix and mentions the affected APIs and mysql_fdw build issue.
Linked Issues check ✅ Passed The PR restores the upstream ExecTypeFromTL(List *) API and updates callers, fixing the mysql_fdw incompatibility described in #1379.
Docstring Coverage ✅ Passed Docstring coverage is 94.12% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/include/access/tupdesc.h (1)

216-218: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add 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 _N macros 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 _R macros safely anchors the ellipsis, completing the intended strict, warning-free ISO C99 compliance without affecting the selected macro suffix N.

  • src/include/access/tupdesc.h#L216-L218: append , 0 to the expansion: ivorysql_createTupleDesc_N(__VA_ARGS__, 4, 3, 2, 0)
  • src/include/executor/executor.h#L651-L653: append , 0 to the expansion: ivorysql_execTypeFromTL_N(__VA_ARGS__, 2, 1, 0)
  • src/include/executor/executor.h#L655-L657: append , 0 to the expansion: ivorysql_execCleanTypeFromTL_N(__VA_ARGS__, 2, 1, 0)
  • src/include/executor/executor.h#L665-L667: append , 0 to 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

📥 Commits

Reviewing files that changed from the base of the PR and between 15d3b5b and 33618ed.

📒 Files selected for processing (5)
  • src/backend/access/common/tupdesc.c
  • src/backend/executor/execJunk.c
  • src/backend/executor/execTuples.c
  • src/include/access/tupdesc.h
  • src/include/executor/executor.h

123123213weqw added a commit to 123123213weqw/IvorySQL that referenced this pull request Jul 20, 2026
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]>
@bigplaice bigplaice self-assigned this Jul 20, 2026
@bigplaice

Copy link
Copy Markdown
Collaborator

I will take a look, thanks.

@bigplaice

Copy link
Copy Markdown
Collaborator

A plain rename of 18 internal callers would achieve the same goal with far less preprocessor magic, why not?
Your patch can fix build issue but also bring ABI breakage.

@123123213weqw

Copy link
Copy Markdown
Contributor Author

Good points, both.

You're right on the ABI breakage: by replacing the ExecTypeFromTL symbol with _1/_2 variants, my patch fixes source compat but breaks the symbol for any pre-compiled extension built against upstream PG (and the macro dispatch also means the public name can no longer be taken as a function pointer). Given IvorySQL's compatibility-first positioning, preserving the upstream ABI is worth the rename.

I'll rework this to approach B: keep the upstream signatures and symbol names untouched (ExecTypeFromTL(List *) returns ExecTypeFromTLInternal(tl, false, false), etc.), and expose the IvorySQL rowid-aware variants under new names (ExecTypeFromTLWithRowId(List *, bool hasrowid), ExecInitJunkFilterWithRowId(...), CreateTupleDescWithRowId(...)). Then update the ~18 internal call sites that currently pass hasrowid to use the new names. External extensions written against upstream PostgreSQL continue to compile and link unchanged.

Will push the rework to this PR once ready.

123123213weqw added a commit to 123123213weqw/IvorySQL that referenced this pull request Jul 20, 2026
…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]>
@123123213weqw
123123213weqw force-pushed the wangyue/fix-1379-ext-compat-shim branch from 38def85 to 9ad45e7 Compare July 20, 2026 10:08
@123123213weqw 123123213weqw changed the title compat: source-compat shims for ExecTypeFromTL and friends (fix mysql_fdw build) compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build) Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/backend/bootstrap/bootparse.y (1)

180-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer upstream-compatible wrappers over explicit *WithRowId calls passing false.

These call sites explicitly invoke the *WithRowId variants while passing hardcoded false flags 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 with CreateTupleDesc(numattr, attrtypes);
  • src/backend/bootstrap/bootstrap.c#L652-L652: replace with CreateTupleDesc(numattr, attrtypes);
  • src/backend/executor/functions.c#L833-L833: replace with ExecInitJunkFilter(resulttlist, slot);
  • src/backend/tcop/pquery.c#L673-L673: replace with ExecCleanTypeFromTL(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

📥 Commits

Reviewing files that changed from the base of the PR and between 38def85 and 9ad45e7.

📒 Files selected for processing (19)
  • src/backend/access/common/tupdesc.c
  • src/backend/bootstrap/bootparse.y
  • src/backend/bootstrap/bootstrap.c
  • src/backend/catalog/heap.c
  • src/backend/executor/execExpr.c
  • src/backend/executor/execJunk.c
  • src/backend/executor/execMain.c
  • src/backend/executor/execTuples.c
  • src/backend/executor/functions.c
  • src/backend/executor/nodeAgg.c
  • src/backend/executor/nodeCustom.c
  • src/backend/executor/nodeForeignscan.c
  • src/backend/executor/nodeIndexonlyscan.c
  • src/backend/executor/nodeSubplan.c
  • src/backend/tcop/pquery.c
  • src/backend/utils/adt/orderedsetaggs.c
  • src/backend/utils/cache/plancache.c
  • src/include/access/tupdesc.h
  • src/include/executor/executor.h

@bigplaice

Copy link
Copy Markdown
Collaborator

LGTM.
@hanjianqiao

@hanjianqiao

Copy link
Copy Markdown
Collaborator

Thanks for all your work! The problem is solved.

@123123213weqw

Copy link
Copy Markdown
Contributor Author

Thanks @hanjianqiao! CI is green on the latest push. Ready to merge whenever you have a moment — no rush.

@bigplaice

Copy link
Copy Markdown
Collaborator

@123123213weqw Hi, please solve the conflict so that it can be merged.

@123123213weqw
123123213weqw force-pushed the wangyue/fix-1379-ext-compat-shim branch from 9ad45e7 to 32a0f6d Compare July 27, 2026 03:09
123123213weqw added a commit to 123123213weqw/IvorySQL that referenced this pull request Jul 27, 2026
…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
123123213weqw added a commit to 123123213weqw/IvorySQL that referenced this pull request Jul 27, 2026
…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
@123123213weqw
123123213weqw force-pushed the wangyue/fix-1379-ext-compat-shim branch from 32a0f6d to ea6dbca Compare July 27, 2026 03:32
…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
@123123213weqw
123123213weqw force-pushed the wangyue/fix-1379-ext-compat-shim branch from ea6dbca to a23e573 Compare July 27, 2026 03:58
@123123213weqw

Copy link
Copy Markdown
Contributor Author

CI failure fixed in ccb7355df6: use a strict (void) prototype for dbms_lock_init_hash_table.

Validated locally with the CI -Werror flags from a clean build; all GitHub Actions checks are now green.

@123123213weqw

Copy link
Copy Markdown
Contributor Author

@123123213weqw Hi, please solve the conflict so that it can be merged.

done

@gaoxueyu
gaoxueyu merged commit 39f94b0 into IvorySQL:master Jul 27, 2026
7 checks passed
hs-liuxh pushed a commit to hs-liuxh/IvorySQL that referenced this pull request Sep 2, 2026
…ext-compat-shim

compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build)
(cherry picked from commit 39f94b0)
hs-liuxh pushed a commit to hs-liuxh/IvorySQL that referenced this pull request Sep 2, 2026
…ext-compat-shim

compat: restore upstream signatures for ExecTypeFromTL and friends (fix mysql_fdw build)
(cherry picked from commit 39f94b0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mysql_fdw fails to compile on IvorySQL 5.4

4 participants