graphql-engine/server/tests-py/queries/v1
Auke Booij fe8eabff19 server: fix the nullability of object relationships (fix hasura/graphql-engine#7201)
When adding object relationships, we set the nullability of the generated GraphQL field based on whether the database backend enforces that the referenced data always exists. For manual relationships (corresponding to `manual_configuration`), the database backend is unaware of any relationship between data, and hence such fields are always set to be nullable.

For relationships generated from foreign key constraints (corresponding to `foreign_key_constraint_on`), we distinguish between two cases:

1. The "forward" object relationship from a referencing table (i.e. which has the foreign key constraint) to a referenced table. This should be set to be non-nullable when all referencing columns are non-nullable. But in fact, it used to set it to be non-nullable if *any* referencing column is non-nullable, which is only correct in Postgres when `MATCH FULL` is set (a flag we don't consider). This fixes that by changing a boolean conjunction to a disjunction.
2. The "reverse" object relationship from a referenced table to a referencing table which has the foreign key constraint. This should always be set to be nullable. But in fact, it used to always be set to non-nullable, as was reported in hasura/graphql-engine#7201. This fixes that.

Moreover, we have moved the computation of the nullability from `Hasura.RQL.DDL.Relationship` to `Hasura.GraphQL.Schema.Select`: this nullability used to be passed through the `riIsNullable` field of `RelInfo`, but for array relationships this information is not actually used, and moreover the remaining fields of `RelInfo` are already enough to deduce the nullability.

This also adds regression tests for both (1) and (2) above.

https://github.com/hasura/graphql-engine-mono/pull/2159

GitOrigin-RevId: 617f12765614f49746d18d3368f41dfae2f3e6ca
2021-08-26 15:27:34 +00:00
..
basic [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
bulk [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
computed_fields server: do not do a "successful" noop when tracking a function in the wrong source 2021-05-27 12:09:19 +00:00
count Integration test improvements (for speed/clarity), also increase polling interval for scheduled events 2021-04-27 05:35:26 +00:00
ddl server: move to storing metadata as a json blob (#115) 2020-12-08 14:23:28 +00:00
delete [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
insert [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
metadata server: fix untrack_function for non-default source 2021-08-19 10:28:49 +00:00
metadata_order Optimistic Metadata Locking 2021-02-19 02:40:23 +00:00
non_empty_text check input for empty strings for metadata api (close #2302) (#2300) 2019-07-11 09:00:45 +00:00
permissions [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
relationships server: fix the nullability of object relationships (fix hasura/graphql-engine#7201) 2021-08-26 15:27:34 +00:00
run_sql server: add tests ensuring the correct functioning of all endpoints based on user roles 2021-07-16 16:09:25 +00:00
select server: add tests ensuring the correct functioning of all endpoints based on user roles 2021-07-16 16:09:25 +00:00
set_table_configuration server: include more detail in inconsistent metadata error messages (fix #6684) 2021-05-19 05:02:53 +00:00
set_table_custom_fields server: include more detail in inconsistent metadata error messages (fix #6684) 2021-05-19 05:02:53 +00:00
set_table_is_enum server: include more detail in inconsistent metadata error messages (fix #6684) 2021-05-19 05:02:53 +00:00
track_table Server: fix issue of not being able to track tables with non-compliant GraphQL names (#313) 2021-01-12 08:13:58 +00:00
update [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00