Fix setting identity for fetching column information for postgres 9.x
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
The postgres adapter when fetching all columns from a table uses this logic to construct the column:
The problem here is that $columnInfo['is_identity'] is probably always no for postgres 9.x per its documentation:
is_identity yes_or_no Applies to a feature not available in PostgreSQL
It looks like this feature was added in 10.x. For 9.x, we can probably introduce an alternative scheme where it checks the default and minimally determines that if it is something like nextval('tablename_colname_seq'::regclass), then it is an identity column.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Phinx/Db/Adapter/PostgresAdapter.php around lines 430-436, then compare the PostgreSQL 9.6 information-schema documentation with the current identity-column logic. The work is done when column fetching correctly identifies serial-style identity columns on PostgreSQL 9.x without breaking behavior on newer PostgreSQL versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100