Skip to content

Relay Preset adds combo pk/fk to update patch #2334

Open
@jcgsville

Description

@jcgsville

Summary

If you create a table foo whose primary key is also a foreign key, the update patch incorrectly includes the primary key, even though the DB does not allow you to update the value of the primary key.

Steps to reproduce

create table foo (id int primary key);
create table bar (id int primary key references foo.id, val text);

Relevant parts of my preset:

ts

  extends: [
    PostGraphileAmberPreset,
    PostGraphileRelayPreset,
    PgSimplifyInflectionPreset,
  ],
  schema: {
    pgSimplifyAllRows: false,
    pgShortPk: false,
  },
  plugins: [
    SmartTagsPlugin,

Expected results

input BarPatch {
  val: String
}

Actual results

input BarPatch {
  val: String
  foo: ID
}

Additional context

node --version
v22.12.0
    "@dataplan/json": "0.0.1-beta.28",
    "@dataplan/pg": "0.0.1-beta.30",
    "@graphile/simplify-inflection": "8.0.0-beta.5",
    "graphile-build": "5.0.0-beta.31",
    "graphile-build-pg": "5.0.0-beta.36",
    "postgraphile": "5.0.0-beta.37"

From Benjie, on Discord:

This is the Relay preset tweaking behaviour haphazardly
It’s probably something like -update:nodeId
Please file an issue; this will be a breaking change so needs to go out before release

Possible Solution

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status

      🌳 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions