Skip to content

fix: restore OCI8 Oracle pagination backward compatibility - #10678

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

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

Conversation

@joshuadave143

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 16:14
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@joshuadave143
joshuadave143 force-pushed the fix/oci8-oracle-pagination-backward-compatibility branch from 0cf04f4 to 4153a74 Compare October 29, 2026 08:28
@joshuadave143 joshuadave143 changed the title Fix: oci8 oracle pagination backward compatibility fix: restore OCI8 Oracle pagination backward compatibility Oct 29, 2026
@carson-codeigniter4 carson-codeigniter4 Bot added the bug Verified issues on the current code behavior or pull requests that will fix them label Oct 29, 2026
@michalsn

Copy link
Copy Markdown
Member

TL;DR - it was working by accident.

Oracle Database 12.1 has been the documented minimum since the OCI8 driver was introduced in CodeIgniter 4.2.0. This requirement was explicitly discussed in the original driver PR and included in its documentation.

Although earlier releases retained a ROWNUM pagination fallback, its presence did not mean Oracle 11g was a supported platform. Some queries could work, but that did not establish compatibility for the driver as a whole.

Also, the fallback was removed in 4.6.1, through #9472. That change followed the existing minimum requirement and addressed a pagination issue where version detection could incorrectly select the legacy path even on Oracle 19c, see #9469.

Reintroducing this pagination fallback would still leave Oracle 11g without full driver support - for example, Forge relies on identity columns introduced in Oracle 12.1 for auto-increment support.

This branch has not been deployed

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

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants