-
-
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
Stop considering generated column definition as being its default value #6199
Conversation
I've tested manually on Postgresql 10 (with no support at all of GENERATED column, hence the feature detection code ) , Postgresql 13, 14, 15 For automated test, I've written one, but to be honest I haven't found a documentation on how to run them |
Ok I've finally been able to setup the CI locally for postgresql and correct the coding style so now I'm pretty sure all will be green :) |
@derrabus I see there's still some changes requested in this PR, but normally I've adressed everything ? Is there's something you're waiting from me ? (I don't mean to push you, if it's just a "I didn't have time yet to check it" , no worry I'll way 😊 , it's just I'm suddenly thinking "maybe he's the one waiting for me" ^^" ) |
No, I'm aware that the ball's in my court here. 😓 |
361a954
to
b4d9b2f
Compare
repushed (I forgot to run phpcs locally) and squashed, the previous CI was only failing on IBM DB2 test, but it seems to me it was a flaky test |
b4d9b2f
to
bfb754f
Compare
@derrabus the fail seems to be a flaky test , can you relaunch them ? |
bfb754f
to
96cd2b6
Compare
…ing its default value The `pg_get_expr(adbin, adrelid)` expression in Postgresql's internal table `pg_attrdef` is used to know a column definition for most column, if this returns something, it means this column's default value. So DBAL has been considering has ALWAYS meaning it contains its default. However for generated columns, it contains the value definition and not its default value, so we change the selectTableColumns' query to correctly set the 'default' column to `null` for generated columns It will help setting correctly the column's attributes which in turn will help generate correct schema diff.
Is this sentence broken? I don't understand it. |
yes , sorry I meant DBAL was interpreting "pg_get_expr(adbin, adrelid) returns something" as meaning "the value returned is the default value of the column " while it's a more generic "definition value" which can be the default value , but can also be other things (like the generated column expression ) I think the confusion was that postgresql uses the abbreviated form "pg_attrdef" and one could have interpreted that as "postgresql attribute default" whereas it actually means "postgresql attribute definition" |
@derrabus friendly reminder this PR exists , tell me if you need anything from me :) I can make myself available for a pair review call if you want. |
thanks a lot ! |
* 3.9.x: fix doctrine#6198: stop considering generated column definition as being its default value (doctrine#6199) Fix condition on Ascii String for SQL Server (doctrine#6389) Add DBTypes that are missing for TypeMapping (doctrine#6463)
* 3.9.x: fix doctrine#6198: stop considering generated column definition as being its default value (doctrine#6199) Fix condition on Ascii String for SQL Server (doctrine#6389) Add DBTypes that are missing for TypeMapping (doctrine#6463)
* 3.9.x: fix doctrine#6198: stop considering generated column definition as being its default value (doctrine#6199) Fix condition on Ascii String for SQL Server (doctrine#6389) Add DBTypes that are missing for TypeMapping (doctrine#6463)
* 4.1.x: Prepare 3.9.0 and 4.1.0 (#6492) Deprecate support for Postgres 10 and 11 (#6495) Document the new PostgreSQL120Platform (#6494) fix #6198: stop considering generated column definition as being its default value (#6199) Fix condition on Ascii String for SQL Server (#6389) Add DBTypes that are missing for TypeMapping (#6463)
Summary
The
pg_get_expr(adbin, adrelid)
expression in Postgresql's internal tablepg_attrdef
is used to know a column definitionfor most column, if this returns something, it means this column's default value. So DBAL has been considering has ALWAYS meaning it contains its default.
However for generated columns, it contains the value definition and not its default value, so we change the selectTableColumns' query to correctly set the 'default' column to
null
for generated columnsIt will help setting correctly the column's attributes which in turn will help generate correct schema diff.