wise-coders / dbschema

DbSchema Database Designer
https://dbschema.com
67 stars 3 forks source link

Relational Data Explorer can't add row with, or join on, Postgres enum column #118

Closed nilsso closed 4 months ago

nilsso commented 4 months ago

Not sure if this is Postges specific, but it seems the relational data explorer (RDE) can't join enums.

When joining from one table to another on an enum column it seems the emitted DML treats the to-side as "character varying" while the left-side as the enum type, resulting an "operator does not exist" error.

When creating a row in RDE I have a similar issue:

ERROR: column "role" is of type userrole but expression is of type character varying
  Hint: You will need to rewrite or cast the expression.
  1. Please check DbSchema Help / Output logs for errors.
Data Loading Error
Error by reading from 'post'. operator does not exist: userrole = character varying
Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Position: 271
DbSchema Advice

Inform DbSchema team using Help / Technical Support.

Details:

org.postgresql.util.PSQLException: ERROR: operator does not exist: userrole = character varying
  Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
  Position: 271
  at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
  at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
  at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
  at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
  at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
  at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
  at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)
  at com.wisecoders.dbs.dbms.connect.model.envoy.SelectStatement.a(SelectStatement.java:85)
  at com.wisecoders.dbs.dbms.connect.model.envoy.SelectStatement.j(SelectStatement.java:93)
  at com.wisecoders.dbs.browse.query.BrowseSQLStore.a(BrowseSQLStore.java:135)
  at com.wisecoders.dbs.browse.query.FxBrowseLoaderTask.a(FxBrowseLoaderTask.java:75)
  at com.wisecoders.dbs.browse.query.FxBrowseLoaderTask.a(FxBrowseLoaderTask.java:59)
  at com.wisecoders.dbs.browse.query.FxBrowseLoaderTask.b(FxBrowseLoaderTask.java:51)
  at com.wisecoders.dbs.browse.query.FxBrowseLoaderTask.call(FxBrowseLoaderTask.java:17)
  1. Please include the DbSchema version, operating system and used database

    • DbSchema 9.5.1 build 240116
    • Apple M1 Pro, Sonoma 14.0
    • PostgreSQL 16.1
  2. The steps to reproduce this issue

    • Start a new RDE using the "from" table (e.g. user)
    • Cascade the "to" table (e.g. post via userrole column post.author_role)
wise-coders commented 4 months ago

Thank you for reporting this issue. A fix will be available right on Monday morning, under: https://dbschema.com/beta.php

nilsso commented 4 months ago

Thanks a ton! Is working like a charm so far