-
-
Notifications
You must be signed in to change notification settings - Fork 570
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
Strange CRUD mutation behavior on views with triggers #1138
Comments
After a bit more testing, adding the |
Could you check these assertions, perhaps they're wrong: |
Here's my (slightly abbreviated to remove boilerplate output) test session, using the
Based on that, it would appear that the assertions you linked are mixed up (at least in the case of my example schema from the OP on this issue). The corrected assertions would be:
|
I'm submitting a ...
PostGraphile version: 4.4.3
Minimal SQL file that can be loaded into a clean database:
Steps to reproduce:
After loading the above sql schema into a db named
testdb
, running:Current behavior:
GraphiQL shows the expected queries for the
entity_joined
view, plus two mutationsupdateEntityJoined
andupdateEntityJoinedById
. Calling those mutations results in a postgresql exceptioncannot update view "entity_joined"
.Expected behavior:
Since
entity_joined
selects from two tables, it is not updatable, so without anINSTEAD OF UPDATE
trigger defined I wouldn't expect to see theupdate
mutations generated for it.Since it does have an
INSTEAD OF INSERT
trigger defined, I would expect to seecreate
mutations generated for it.Now if I also add an
INSTEAD OF DELETE
trigger to the view and re-run postgraphile, it does generate acreateEntityJoined
mutation, but nodeleteEntityJoined
mutation. So it seems like the CRUD mutations are being affected somehow by the presence or absence of triggers on the view, but not in a way that seems to make any sense.The text was updated successfully, but these errors were encountered: