-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passive support for partitioned tables on Postgres #6516
Passive support for partitioned tables on Postgres #6516
Conversation
d95aa5d
to
7cfb67d
Compare
Thank you for your PR!
For me it's the other way round. I'd like to see functional tests before I can decide if we accept a certain change. 😓 If I got your PR right, you want the schema manager to detect a partitioned table without introducing the concept of partitioned tables itself to DBAL's schema management. That means, a partitioned table would appear along other non-partitioned tables with no way of telling them apart. Does that sound like your plan? If so, does the change detection work properly on those tables? And would the schema manager be able to create a proper diff including correct SQL/DDL for partitioned tables? |
hi, thanks for your quick answer :)
no prob, I'll work on that in few times
this is exact
yep, a partitioned table is the main table, its partitions should be transparent to doctrine. Moreover, I was told that this is the current behavior of doctrine with MySQL (meaning: you can change the table as partition table in your migration, and the schema manager still sees it as a normal table, and does not see any partition)
yes. With this tiny change, everything is OK, any modification to the entity will create a diff |
I need a functional test that covers this exact scenario: A manually created partitioned table on which we detect a modification (column/index added/changed/removed). We execute the generated DDL statements and afterwards we still have a partitioned table, but with the necessary modifications applied. |
37101f7
to
57620a0
Compare
@derrabus I've added the test
Not sure how to test this 🤔 should I require on table |
Yes. Use Postgres' own tooling to see if the table is still a partitioned table and if it's partitions are still there. I want to make sure that a partitioned table is not accidentally destroyed by any DDL we emit. |
ca58b57
to
30b7856
Compare
30b7856
to
2e4f578
Compare
The test failures seem to be related to your changes. |
yeah postgreSQL version problem: primary key are only supported on partitioned tables since version 11. I'll see this tomorrow |
We intend to drop support for Postgres 10 in DBAL 5, but that's not helping you right now, is it. 😓 |
2e4f578
to
c5d165e
Compare
I removed the PK, I thought it was needed but it seems it is not, so it might work for all versions |
ok, I need to run the tests locally on pg 10 😅 |
c5d165e
to
9fe2871
Compare
done: the test is passing in both versions 10 & 15 of pg |
cool CI green 🎉 the last failure seems not related to my PR 😅 |
Awesome, thank you very much. |
* 4.2.x: Passive support for partitioned tables on Postgres (#6516) fix typo
Thank you for your work ! |
Partitioned tables is a complex topic which is not fully supported by Doctrine.
Currently, with PostgreSQL, Doctrine does not "see" partitioned tables, and only "sees" partitions, which is problematic and should be done the other way. This PR fixes this in
PostgreSQLSchemaManager::selectTableColumns()
.Before this PR:
After this PR:
doctrine:schema:validate
is happy, even if tables have been partitioned manuallysee #4657 (comment)
Note: I'd want to see if maintainers folks are willing to accept such modification before digging into the tests for this