edgedb-ui icon indicating copy to clipboard operation
edgedb-ui copied to clipboard

UI fails to show data if there are items with empty links inside `assert_exists()`

Open MrFoxPro opened this issue 1 year ago • 6 comments

Example schema:

module default {
  type A {
    multi b: B { constrain exclusive; on source delete delete target; };
  }
  type B {
    required single link a := assert_exists(.<b[is A])
  }
}

Then run query insert B {} or insert item B manually in UI and navigate to table B. UI will show error Failed to fetch data and will fail to show any data. Error in console CardinalityViolationError: assert_exists violation: expression returned an empty set image

MrFoxPro avatar Nov 14 '23 09:11 MrFoxPro

This seems like correct behavior. Maybe you'd want the error message in the UI instead of Failed to fetch data

jackfischer avatar Nov 27 '23 14:11 jackfischer

This seems like correct behavior. Maybe you'd want the error message in the UI instead of Failed to fetch data

I belive it should show entities that don't violate constraint

MrFoxPro avatar Nov 27 '23 15:11 MrFoxPro

Data is broken at the schema level though - wouldn't you receive the same error making an equivalent query in the CLI?

jackfischer avatar Nov 27 '23 18:11 jackfischer

Data is broken at the schema level though - wouldn't you receive the same error making an equivalent query in the CLI?

In CLI it's unlikely to select all items at once

MrFoxPro avatar Nov 27 '23 18:11 MrFoxPro

I often try to use UI to investigate problem. I believe a good way to do this is to show normal items and then section with broken. And Ability to load them without causing issues properties

MrFoxPro avatar Nov 27 '23 19:11 MrFoxPro

I'll look into fixing/improving this, but the fix will likely be just detecting the error and then disabling fetching data for the offending column, similar to how access policy errors are handled. Since multiple rows of data are fetched at a time, unfortunately I don't think it's currently possible to exclude just the broken row.

jaclarke avatar Nov 27 '23 20:11 jaclarke