Hello,

I am using H2 2.1.214 and I am using the "CREATE LINKED TABLE" feature to
connect to a postgres (postgres 13) database.

Not sure whether this is of importance but in this specal case I am linking
to a view on the postgres server which is augmented with an "instead of"
trigger.

Everything seems fine when reading the linked tables but when I try to
write I get the error message back, that the column mentioned in the update
is not existing.

--> update reloadflag_disabled set rf=true;

2022-10-13 16:19:29 jdbc[4]:
/**/stat1.execute("update reloadflag_disabled set rf=true");
2022-10-13 16:19:29 jdbc[4]: Table      :     potential plan item cost
2.101 index PUBLIC.""
2022-10-13 16:19:29 table: RELOADFLAG_DISABLED:
SELECT * FROM RELOADFLAG_DISABLED T;
2022-10-13 16:19:29 table: RELOADFLAG_DISABLED:
DELETE FROM RELOADFLAG_DISABLED WHERE "RF"=?  {1: FALSE};
2022-10-13 16:19:29 table: RELOADFLAG_DISABLED:
DELETE FROM RELOADFLAG_DISABLED WHERE "RF"=?  {1: FALSE};
2022-10-13 16:19:29 table: RELOADFLAG_DISABLED:
DELETE FROM RELOADFLAG_DISABLED WHERE "RF"=?  {1: FALSE};
2022-10-13 16:19:29 jdbc[4]: exception
org.h2.jdbc.JdbcSQLNonTransientException: Fehler beim Zugriff auf eine
verknüpfte Tabelle mit SQL Befehl "DELETE FROM RELOADFLAG_DISABLED WHERE
""RF""=? ", Grund: "org.postgresql.util.PSQLException: ERROR: column ""RF""
does not exist\000a  Position: 39"
Error accessing linked table with SQL statement "DELETE FROM
RELOADFLAG_DISABLED WHERE ""RF""=? ", cause:
"org.postgresql.util.PSQLException: ERROR: column ""RF"" does not
exist\000a  Position: 39"; SQL statement:

As far as I understand the trace output, H2 is quoting the column name and
sending it in upper case letters. So postgres' reaction is in so far
correct.

I tried modifiying the connection by adding
;MODE=PostgreSQL;DATABASE_TO_LOWER=TRUE.

This changes the error message in a way indicating that h2 now has internal
problems identifiying the column.

2022-10-13 16:23:08 jdbc[4]:
/**/stat1.execute("update reloadflag_disabled set rf=true");
2022-10-13 16:23:08 jdbc[4]: exception
org.h2.jdbc.JdbcSQLSyntaxErrorException: Feld "rf" nicht gefunden
Column "rf" not found; SQL statement:
update reloadflag_disabled set rf=true [42122-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:502)
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
at org.h2.message.DbException.get(DbException.java:223)
at org.h2.message.DbException.get(DbException.java:199)
at org.h2.table.Table.getColumn(Table.java:749)
at org.h2.command.Parser.readTableColumn(Parser.java:1084)
at org.h2.command.Parser.readUpdateSetClause(Parser.java:1151)
at org.h2.command.Parser.parseUpdate(Parser.java:1120)
at org.h2.command.Parser.parsePrepared(Parser.java:858)
at org.h2.command.Parser.parse(Parser.java:689)
at org.h2.command.Parser.parse(Parser.java:661)
at org.h2.command.Parser.prepareCommand(Parser.java:569)

Is there any known solution and/or workaround?

Best regards
Gerhard

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CAJxppmYaPDCwAdwA9-repr%3D91qZEEnHOs%2BaSGisM5aKNgbSHvw%40mail.gmail.com.

Reply via email to