Skip to content

Test ADD_MONTHS month-end behavior across leap years - #3339

Open
Dyu-young wants to merge 1 commit into
IvorySQL:masterfrom
Dyu-young:test/add-months-february-boundaries
Open

Dyu-young wants to merge 1 commit into
IvorySQL:masterfrom
Dyu-young:test/add-months-february-boundaries

Conversation

@Dyu-young

@Dyu-young Dyu-young commented Nov 18, 2026 •

Copy link
Copy Markdown

Closes #3338.

Add three cases to the Oracle-mode datetime regression suite. Moving February 28 forward one month reaches March 31 in a common year and March 28 in a leap year. Moving February 29 backward one month reaches January 31. The SQL and expected output are the only files changed.

Verification

  • Built from upstream 475ab195 with the patch applied and ran make -j1 -C contrib/ivorysql_ora oracle-check TAP_TESTS=. All 36 SQL regression tests passed.
  • Disabled the source-month-end rule in a separate local build. The new cases caught both incorrect results (March 28 instead of March 31, and January 29 instead of January 31). The leap-year February 28 control still passed.

OpenAI Codex (GPT-6) generated the test changes. The human contributor's DCO sign-off and AI attribution are recorded in the commit.

Summary by CodeRabbit

  • Tests
    • Added regression coverage for ADD_MONTHS around February month-end dates in leap and non-leap years, including moving forward and backward by one month.

Cover the same February day in a common year and a leap year, then
step backwards from leap day into January. These cases distinguish
carrying a source month-end from clamping to a shorter target month.

Assisted-by: OpenAI Codex:GPT-6
Percentage of AI-generated code: 100%

Signed-off-by: Dyu-young <2245387130@qq.com>
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ADD_MONTHS regression test adds three February date cases. The expected output records the resulting dates and updates the row count from 5 to 8.

Changes: ADD_MONTHS February regression coverage

Layer / File(s) Summary
February month-end cases
contrib/ivorysql_ora/sql/ora_datetime_datatype_functions.sql, contrib/ivorysql_ora/expected/ora_datetime_datatype_functions.out
The test checks adding one month to February 28, 2023 and February 28, 2024, and subtracting one month from February 29, 2024. The expected results are March 31, March 28, and January 31, 2024, respectively.

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

Change: Other

Suggested reviewers: wangjie-star, bigplaice

Merge Risk: Minimal · up to 2af8d

This change only adds regression tests for ADD_MONTHS month-end behavior across leap years and does not alter runtime behavior. There is no identified production impact, and it looks ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: new regression cases that test ADD_MONTHS month-end behavior across leap and common years. The raw summary shows added February cases in the ora_datetime_datatype_func…
Linked Issues check Passed Issue #3338 asks for three ADD_MONTHS regression cases in ora_datetime_datatype_functions: 2023-02-28 +1, 2024-02-28 +1, and 2024-02-29 -1. The reviewed head contains all three inserts in contrib/ivor…
Out of Scope Changes check Passed According to the PR summary, only two files change: contrib/ivorysql_ora/sql/ora_datetime_datatype_functions.sql (+5 lines, three ADD_MONTHS cases) and contrib/ivorysql_ora/expected/ora_datetime_datat…
Full details: Title check

Explanation

The title names the main change: new regression cases that test ADD_MONTHS month-end behavior across leap and common years. The raw summary shows added February cases in the ora_datetime_datatype_functions test and expected output, and the objectives describe the same three cases from issue #3338. The title is specific and matches the changeset.

Full details: Linked Issues check

Explanation

Issue #3338 asks for three ADD_MONTHS regression cases in ora_datetime_datatype_functions: 2023-02-28 +1, 2024-02-28 +1, and 2024-02-29 -1. The reviewed head contains all three inserts in contrib/ivorysql_ora/sql/ora_datetime_datatype_functions.sql, under an ADD_MONTHS block with a comment that February 28 is month-end only in a non-leap year. The statements match the issue's starting dates and offsets exactly. The PR summary reports that the expected output gained the matching rows (5 to 8 results), and the author reports that all 36 SQL regression tests passed on upstream 475ab19 with the patch. Limitation: the diff and the expected-output file could not be read directly (the diff returned unavailable, and the expected file was not read), so the expected values are supported by the author's run and the AI summary, not by direct inspection of the .out lines. The issue's acceptance criteria are coding requirements (test coverage), and no other coding requirement applies.

Full details: Out of Scope Changes check

Explanation

According to the PR summary, only two files change: contrib/ivorysql_ora/sql/ora_datetime_datatype_functions.sql (+5 lines, three ADD_MONTHS cases) and contrib/ivorysql_ora/expected/ora_datetime_datatype_functions.out (+8/-1, matching expected rows). The SQL file at head shows only the three new ADD_MONTHS statements in the ADD_MONTHS block, with a comment. Both changes implement the regression coverage requested by #3338. No product code, build files, or unrelated tests are reported as changed. The diff itself could not be read, so this verdict relies on the PR summary for the changed-file list.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 475ab19 and 2af8d13.

Files selected for processing: 2

  • contrib/ivorysql_ora/expected/ora_datetime_datatype_functions.out
  • contrib/ivorysql_ora/sql/ora_datetime_datatype_functions.sql

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

@hs-liuxh

Copy link
Copy Markdown
Collaborator

Thanks for contributing to IvorySQL!

@hs-liuxh hs-liuxh self-assigned this Nov 20, 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.

Cover February month-end propagation in ADD_MONTHS regression tests

2 participants