Skip to content
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

Nested mutation fails if parent row is not selected/updated #37

Conversation

juliendangers
Copy link
Contributor

@juliendangers juliendangers commented Sep 2, 2020

Hello,

There is an issue on nested mutation, if you do not have the right to update the parent row. You end up trying to access a column of undefined there https://github.com/mlipscombe/postgraphile-plugin-nested-mutations/blob/master/src/PostgraphileNestedMutationsPlugin.js#L443

Here is a quick way to reproduce (may not be working yet, I'm on it):

create table a (
  id integer not null PRIMARY,
  name text null
);
grant select, insert on a to :DATABASE_VISITOR;

create table b (
  id integer not null PRIMARY,
  name text null
  a integer null references a
);
create index on b (a);
grant select, insert on b to :DATABASE_VISITOR;

insert into b (1, 'test 1', null);

Then perform a graphql nested mutation by creating a new a, and trying to connect it to b. Since b cannot be updated, pgNestedTableConnect will return undefined.

By the way, we create a stable branch, and tags v1.1.0 (with fixes from #16, #24) and v1.1.1 (v1.1.0 + current commit) on our own repository, since that one does not seem maintained anymore. We have several people working on graphile at Sterblue, and are relying a lot on nested mutations plugin.

Lenz Weber and others added 3 commits September 1, 2020 19:11
This is supposed to fix an issue where a unique requirement on a column prohibits inserting new rows before the old rows have been deleted.

Fixes mlipscombe#15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants