diff --git a/crates/query-engine/translation/src/translation/mutation/insert.rs b/crates/query-engine/translation/src/translation/mutation/insert.rs index 1072e7c23..52cd0bfdf 100644 --- a/crates/query-engine/translation/src/translation/mutation/insert.rs +++ b/crates/query-engine/translation/src/translation/mutation/insert.rs @@ -91,11 +91,15 @@ fn check_columns( ) -> Result<(), Error> { for (name, column) in columns.iter() { match column { - // nullable and identity by default columns can be inserted into or omitted. + // nullable, default, and identity by default columns can be inserted into or omitted. database::ColumnInfo { nullable: database::Nullable::Nullable, .. } + | database::ColumnInfo { + has_default: database::HasDefault::HasDefault, + .. + } | database::ColumnInfo { is_identity: database::IsIdentity::IdentityByDefault, .. diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap index dc814f38f..1138612cd 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap @@ -635,7 +635,7 @@ expression: default_configuration "birthday": { "name": "birthday", "type": "date", - "nullable": "nullable", + "nullable": "nonNullable", "description": null }, "height_cm": { diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap index 4d82adb7b..053f20db7 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap @@ -768,7 +768,7 @@ expression: default_configuration "type": { "scalarType": "date" }, - "nullable": "nullable", + "nullable": "nonNullable", "hasDefault": "hasDefault", "description": null }, diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap index 4aa8a8dde..8e2cf2f69 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap @@ -2109,11 +2109,8 @@ expression: result }, "birthday": { "type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } + "type": "named", + "name": "date" } }, "height_cm": { @@ -2960,11 +2957,8 @@ expression: result }, "birthday": { "type": { - "type": "nullable", - "underlying_type": { - "type": "named", - "name": "date" - } + "type": "named", + "name": "date" } }, "height_cm": { diff --git a/static/custom-tables.sql b/static/custom-tables.sql index 829b256e1..390631aad 100644 --- a/static/custom-tables.sql +++ b/static/custom-tables.sql @@ -6,7 +6,7 @@ create schema custom; create table custom.dog ( id bigint primary key generated always as identity, name text not null, - birthday date default '2024-01-17', + birthday date not null default '2024-01-17', adopter_name text null, height_cm numeric not null, height_in numeric GENERATED ALWAYS AS (height_cm / 2.54) STORED diff --git a/static/deployment-snapshots/007e16bbacd12392daa1f0791ba1cb491a23ef88d1110c83cc6eda56b89e5511.json b/static/deployment-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json similarity index 99% rename from static/deployment-snapshots/007e16bbacd12392daa1f0791ba1cb491a23ef88d1110c83cc6eda56b89e5511.json rename to static/deployment-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json index dd70775e1..d2c01d8d4 100644 --- a/static/deployment-snapshots/007e16bbacd12392daa1f0791ba1cb491a23ef88d1110c83cc6eda56b89e5511.json +++ b/static/deployment-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json @@ -742,7 +742,7 @@ "type": { "scalarType": "date" }, - "nullable": "nullable", + "nullable": "nonNullable", "hasDefault": "hasDefault", "description": null }, diff --git a/static/deployment-snapshots/12be4cff0e9f14de07d3369798ced2805708c5ad75ea6a92fb1b2308781e8fae.json b/static/deployment-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json similarity index 99% rename from static/deployment-snapshots/12be4cff0e9f14de07d3369798ced2805708c5ad75ea6a92fb1b2308781e8fae.json rename to static/deployment-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json index 6e128164d..5dd744c3a 100644 --- a/static/deployment-snapshots/12be4cff0e9f14de07d3369798ced2805708c5ad75ea6a92fb1b2308781e8fae.json +++ b/static/deployment-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json @@ -609,7 +609,7 @@ "birthday": { "name": "birthday", "type": "date", - "nullable": "nullable", + "nullable": "nonNullable", "description": null }, "height_cm": { diff --git a/static/postgres/v1-chinook-deployment.json b/static/postgres/v1-chinook-deployment.json index 6e128164d..5dd744c3a 100644 --- a/static/postgres/v1-chinook-deployment.json +++ b/static/postgres/v1-chinook-deployment.json @@ -609,7 +609,7 @@ "birthday": { "name": "birthday", "type": "date", - "nullable": "nullable", + "nullable": "nonNullable", "description": null }, "height_cm": { diff --git a/static/postgres/v2-chinook-deployment.json b/static/postgres/v2-chinook-deployment.json index dd70775e1..d2c01d8d4 100644 --- a/static/postgres/v2-chinook-deployment.json +++ b/static/postgres/v2-chinook-deployment.json @@ -742,7 +742,7 @@ "type": { "scalarType": "date" }, - "nullable": "nullable", + "nullable": "nonNullable", "hasDefault": "hasDefault", "description": null },