Skip to content

fix: escape table, column, and sequence names in Postgre Connection::insertID() - #10735

Merged
paulbalandan merged 1 commit into
codeigniter4:developfrom
gr8man:fix/postgre-connection-insert-id-escape
Nov 14, 2026
Merged

paulbalandan merged 1 commit into
codeigniter4:developfrom
gr8man:fix/postgre-connection-insert-id-escape

Conversation

@gr8man

@gr8man gr8man commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description
Postgre\Connection::insertID() interpolated table, column, and sequence names directly in queries without escaping, which could cause syntax errors or unintended queries when names contained quotes or special characters. This change escapes them using $this->escape().

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

@carson-codeigniter4 carson-codeigniter4 Bot added needs template Opened issues not following the bug form template bug Verified issues on the current code behavior or pull requests that will fix them labels Nov 5, 2026
@carson-codeigniter4

This comment has been minimized.

@carson-codeigniter4 carson-codeigniter4 Bot removed the needs template Opened issues not following the bug form template label Nov 5, 2026

@michalsn michalsn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please replace the namespace-level function mocks with a live PostgreSQL regression test using a temporary table with an apostrophe in its column name. Explicitly drop it after the test to avoid affecting other tests, since listTables() does not include temporary tables by default.

Those mocks remain active throughout the PHP process and affect other tests using the driver.

@gr8man
gr8man force-pushed the fix/postgre-connection-insert-id-escape branch from 4da87dc to 3c8db0e Compare November 9, 2026 19:10
@gr8man
gr8man force-pushed the fix/postgre-connection-insert-id-escape branch 2 times, most recently from 759987a to 1aabb87 Compare November 12, 2026 22:25

@paulbalandan paulbalandan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please rebase to fix conflicts.

@gr8man
gr8man force-pushed the fix/postgre-connection-insert-id-escape branch from 1aabb87 to 9349644 Compare November 13, 2026 10:14
@gr8man
gr8man force-pushed the fix/postgre-connection-insert-id-escape branch from 9349644 to 9916d02 Compare November 13, 2026 19:24
@paulbalandan paulbalandan changed the title fix(Database): escape table, column, and sequence names in Postgre Connection::insertID() fix: escape table, column, and sequence names in Postgre Connection::insertID() Nov 14, 2026
@paulbalandan
paulbalandan merged commit 49e5001 into codeigniter4:develop Nov 14, 2026
60 checks passed
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.

3 participants