Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
materializations: don't try to drop nullability if the projection has…
… a default value In e852e80, materializations were made aware of the possibility for default values in the materialized columns, and that we should not try to drop "not null" constraints on columns like this, under the assumption that the destination system is fine with us sending a "null" since it will automatically be populated (in a sense) with that default value. This didn't take into consideration the fact that Flow projections can also have default values, and in this case we will never see a "null" for these fields from the Flow runtime, and instead will always see that default value. So here too we do not need to drop nullability constraints - the materialized columns can stay "not null" and as long as there is that default value annotation things will work fine. This is particularly important for materializing nullable collection keys with default values. This is allowed (see 5d53313 as well), and some systems like postgres consider primary key fields non-nullable. Prior to this commit, the connector would try to drop a "not null" constraint on a primary key column that was created from a projection with a default value if the materialized column didn't have a default value. We don't currently create columns with default values based on projections (though maybe we will, later) so this would cause the materialization to fail the next time it tries to do an `Apply`. But now, the materialization will not try to drop a "not null" on a materialized key field as long as the projection has a default value.
- Loading branch information