Skip to content

Add ecosystem component: pg_track_settings - #1944

Open
hanjianqiao wants to merge 1 commit into
IvorySQL:masterfrom
hanjianqiao:pg_track_settings
Open

Add ecosystem component: pg_track_settings#1944
hanjianqiao wants to merge 1 commit into
IvorySQL:masterfrom
hanjianqiao:pg_track_settings

Conversation

@hanjianqiao

@hanjianqiao hanjianqiao commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Closes #1938

Overview

When pg_track_settings creates its tables, it declares timestamp columns as timestamp with time zone (equivalent to pg_catalog.timestamptz). In IvorySQL's Oracle parser, the timestamp with time zone spelling is resolved to the sys.oratimestamptz type, which leads to type incompatibility. We therefore need to restrict it to PG mode during initialization.

Detailed Analysis

The root cause of pg_track_settings not being usable — or even creatable — under Oracle compatibility mode is that its core tables and functions declare a large number of columns and return types like this:

CREATE TABLE pg_track_settings_history (
    ts timestamp with time zone,
    ...
);  
CREATE FUNCTION pg_track_settings_settings_src(...)
RETURNS TABLE (ts timestamp with time zone, ...) AS $$
    RETURN QUERY SELECT now(), ...
$$; 

In ora_gram.y (src/backend/oracle_parser/ora_gram.y:17310), the TIMESTAMP [WITH TIME ZONE] keywords have dedicated productions:

opt_timezone:
			WITH_LA TIME ZONE						{ $$ = true; }
			| WITHOUT_LA TIME ZONE					{ $$ = false; }
			| /*EMPTY*/								{ $$ = false; }
		;
Datetime:
    ...
    | TIMESTAMP opt_timezone
        {
            if (ORA_PARSER == compatible_db)
            {
                if ($2)
                    $$ = OracleSystemTypeName("oratimestamptz");        // resolved to sys.oratimestamptz
                else
                    $$ = OracleSystemTypeName("oratimestamp");
                $$->typmods = list_make1(makeIntConst(6, -1));
                $$->location = @1;
            }
            else
            {
                if ($2)
                    $$ = SystemTypeName("timestamptz");                 // resolved to pg_catalog.timestamptz
                else
                    $$ = SystemTypeName("timestamp");
                $$->location = @1;
            }
        }
    | ...

The official PostgreSQL documentation states explicitly that timestamptz is accepted as an abbreviation for timestamp with time zone. Meanwhile, now() — a built-in function implemented in C — always has a fixed return type of pg_catalog.timestamptz in pg_proc, regardless of the current parser mode.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 515efce4-c524-47f1-9962-98f2134acc38

📥 Commits

Reviewing files that changed from the base of the PR and between 481c238 and 765779a.

📒 Files selected for processing (1)
  • src/backend/commands/extension.c

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The core extension allowlist now includes pg_track_settings for PostgreSQL dialect handling in Oracle-mode clusters.

Changes

Extension dialect handling

Layer / File(s) Summary
Add pg_track_settings to the dialect allowlist
src/backend/commands/extension.c
The PgDialectExtensions allowlist now includes pg_track_settings.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 76577

pg_track_settings installation now uses PostgreSQL dialect handling in Oracle-compatible mode, preventing its timestamp type incompatibility. The targeted change is ready to merge.

Suggested reviewers: hs-liuxh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of the pg_track_settings ecosystem component, which matches the main change and PR objective.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 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.

@hanjianqiao hanjianqiao self-assigned this Sep 8, 2026
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.

Add ecosystem component: pg_track_settings

1 participant