cakephp / cakephp/phinx

Rename table instruction for postgres uses quoteColumnName

Open
#1,853 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
4.5k
Forks
884
PR merge metrics
No merged PRs in 30d

Description

Something I noticed while fixing #1851, but did not have time to investigate on writing a testcase for it, so making an issue so as to not lose track of it.

The getRenameTableInstructions for the postgres adapter has the following definition:

https://github.com/cakephp/phinx/blob/1e1597112b919bbe9c864e2d00f2ee7227b36613/src/Phinx/Db/Adapter/PostgresAdapter.php#L352-L362

On line 358, we are using quoteColumnName instead of quoteTableName. This will probably end up doing something unexpected if using a table name with schema. A test should probably be written to verify if that instruction breaks under current conditions and is fixed once that instruction is changed to quoteTableName.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Phinx/Db/Adapter/PostgresAdapter.php at getRenameTableInstructions and inspect the referenced line using quoteColumnName. Add or locate a PostgreSQL adapter test covering a table name with a schema, then verify the generated rename instruction uses the table-name quoting behavior and the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, postgres
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
Half a day
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.