Skip to content

Fix: oci8 oracle pagination backward compatibility - #10677

Closed
joshuadave143 wants to merge 2 commits into
codeigniter4:developfrom
joshuadave143:fix/oci8-oracle-pagination-backward-compatibility
Closed

joshuadave143 wants to merge 2 commits into
codeigniter4:developfrom
joshuadave143:fix/oci8-oracle-pagination-backward-compatibility

Conversation

@joshuadave143

@joshuadave143 joshuadave143 commented Oct 29, 2026 •

Copy link
Copy Markdown

Description

This PR restores backward compatibility for Oracle pagination in the OCI8 Query Builder.

In CodeIgniter 4.2.1, the OCI8 Builder checked the connected Oracle database version before generating pagination SQL. It used OFFSET ... FETCH NEXT for Oracle 12c and above, and ROWNUM-based pagination for older Oracle versions.

In CodeIgniter 4.7.5, this version-dependent handling was removed, causing the driver to always generate OFFSET ... FETCH NEXT pagination syntax.

This causes compatibility issues with older Oracle database versions, particularly Oracle 11g, which does not support this syntax.

Changes Made

  • Restored Oracle database version detection in the OCI8 Builder's _limit() method.
  • Retained OFFSET ... FETCH NEXT pagination for Oracle 12c and above.
  • Restored ROWNUM-based pagination for Oracle versions below 12c.
  • Preserved support for pagination with non-zero offsets.

Reason for the Change

This change prevents existing applications using older Oracle database versions from encountering SQL errors after upgrading CodeIgniter.

It also preserves the existing pagination behavior for newer Oracle database versions.

Testing

The issue was reproduced using CodeIgniter 4.7.5 with Oracle 11g.

The same query worked in CodeIgniter 4.2.1 but failed in CodeIgniter 4.7.5 with:

ORA-00933: SQL command not properly ended

Testing should cover both Oracle 11g and Oracle 12c+ pagination behavior, including non-zero offsets.

Checklist

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

joshuadave143 and others added 2 commits October 29, 2026 15:55
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@carson-codeigniter4 carson-codeigniter4 Bot added the needs template Opened issues not following the bug form template label Oct 29, 2026
@carson-codeigniter4

Copy link
Copy Markdown

Hi there, @joshuadave143! 👋

It looks like this pull request does not follow our template:

Please update the description to follow the template. The needs template label will be removed automatically once it does.


Hi there, @joshuadave143! 👋

Thank you for sending this PR!

We expect the following in all Pull Requests (PRs).

Important

We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works.

If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work
on the framework than you do. Please make it as painless for your contributions to be included as possible.

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md

@joshuadave143 joshuadave143 changed the title Fix/oci8 oracle pagination backward compatibility Fix: oci8 oracle pagination backward compatibility Oct 29, 2026
@michalsn

Copy link
Copy Markdown
Member

https://www.codeigniter.com/user_guide/intro/requirements.html#supported-databases

Oracle 11g is below CodeIgniter's documented minimum requirement of Oracle Database 12.1, which has applied since the OCI8 driver was introduced. Oracle's Extended Support for even the final 11g release ended in December 2020, before the driver's first release in CodeIgniter 4.2.0.

We do not plan to restore compatibility with Oracle 11g. Applications using it will need to upgrade their database to a version supported by CodeIgniter. The legacy pagination fallback happened to work in some cases, but Oracle 11g was never part of the driver's supported compatibility range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs template Opened issues not following the bug form template

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants