TimescaleDB persistence didn't create correct tables

Hi guys,

I have an issue with my current persistence service and hope you can help.

Some details:

  • openHAB version is 3.4.2
  • Persistence service is JDBC with a connection to a TimescaleDB with a PostgreSQL 14.7 version
  • The JDBC service was setup via the web UI:
tableUseRealItemNames -> active
tableCaseSensitiveItemNames -> active

I would expect that an Item (e.g. “Home_Power_Input”) will be stored in a table named “Home_Power_Input”. But the system created a table called “home_power_input”.
The funny thing is that the “wrong named” table is filled with the current values.

The real problem occurs after a restart of the system. The values will not be stored in the lower case table “home_power_input” anymore with the following log entry:

2023-03-05 16:59:29.258 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::store: Unable to store item
org.openhab.persistence.jdbc.internal.exceptions.JdbcSQLException: Error in SQL query!!!; ERROR: table "home_power_input" is already a hypertable Query: SELECT created from create_hypertable('Home_Power_Input', 'time') Parameters: []; Pool Name= yank-default; SQL= SELECT created from create_hypertable('Home_Power_Input', 'time')
	at org.openhab.persistence.jdbc.internal.db.JdbcTimescaledbDAO.doCreateItemTable(JdbcTimescaledbDAO.java:58) ~[?:?]
	at org.openhab.persistence.jdbc.internal.JdbcMapper.createItemTable(JdbcMapper.java:202) ~[?:?]
	at org.openhab.persistence.jdbc.internal.JdbcMapper.getTable(JdbcMapper.java:392) ~[?:?]
	at org.openhab.persistence.jdbc.internal.JdbcMapper.storeItemValue(JdbcMapper.java:217) ~[?:?]
	at org.openhab.persistence.jdbc.internal.JdbcPersistenceService.internalStore(JdbcPersistenceService.java:162) ~[?:?]
	at org.openhab.persistence.jdbc.internal.JdbcPersistenceService.store(JdbcPersistenceService.java:140) ~[?:?]
	at org.openhab.core.persistence.internal.PersistenceManagerImpl.handleStateEvent(PersistenceManagerImpl.java:152) ~[?:?]
	at org.openhab.core.persistence.internal.PersistenceManagerImpl.stateChanged(PersistenceManagerImpl.java:473) ~[?:?]
	at org.openhab.core.items.GenericItem.lambda$1(GenericItem.java:259) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

I think it’s because of the lower case table name, but I don’t know why the JDBC service created them.

Thanks for any help.

I don’t either but this looks like a regression. See How to file an Issue and I think in this case it needs to be filed on the openhab-addons repo tagging the JDBC add-on.