Skip to content

Commit

Permalink
enabling RLS makes inbound relationships nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
olirice committed Jun 27, 2024
1 parent abb9b41 commit 9d2258d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 50 deletions.
1 change: 1 addition & 0 deletions src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,7 @@ impl NodeType {
.columns
.iter()
.any(|c| &c.name == colname && c.is_not_null)
&& !fkey.referenced_table_meta.is_rls_enabled
}) {
__Type::NonNull(NonNullType {
type_: Box::new(type_),
Expand Down
98 changes: 48 additions & 50 deletions test/expected/issue_409_fkey_rls_nullability.out
Original file line number Diff line number Diff line change
Expand Up @@ -210,56 +210,54 @@ begin;
}
$$)
);
jsonb_pretty
-----------------------------------------------
{ +
"data": { +
"__type": { +
"kind": "OBJECT", +
"fields": [ +
{ +
"name": "nodeId", +
"type": { +
"kind": "NON_NULL", +
"name": null, +
"ofType": { +
"name": "ID" +
} +
} +
}, +
{ +
"name": "id", +
"type": { +
"kind": "NON_NULL", +
"name": null, +
"ofType": { +
"name": "Int" +
} +
} +
}, +
{ +
"name": "accountId", +
"type": { +
"kind": "NON_NULL", +
"name": null, +
"ofType": { +
"name": "Int" +
} +
} +
}, +
{ +
"name": "account", +
"type": { +
"kind": "NON_NULL", +
"name": null, +
"ofType": { +
"name": "Account"+
} +
} +
} +
] +
} +
} +
jsonb_pretty
---------------------------------------------
{ +
"data": { +
"__type": { +
"kind": "OBJECT", +
"fields": [ +
{ +
"name": "nodeId", +
"type": { +
"kind": "NON_NULL",+
"name": null, +
"ofType": { +
"name": "ID" +
} +
} +
}, +
{ +
"name": "id", +
"type": { +
"kind": "NON_NULL",+
"name": null, +
"ofType": { +
"name": "Int" +
} +
} +
}, +
{ +
"name": "accountId", +
"type": { +
"kind": "NON_NULL",+
"name": null, +
"ofType": { +
"name": "Int" +
} +
} +
}, +
{ +
"name": "account", +
"type": { +
"kind": "OBJECT", +
"name": "Account", +
"ofType": null +
} +
} +
] +
} +
} +
}
(1 row)

Expand Down

0 comments on commit 9d2258d

Please sign in to comment.