Expaso / hassos-addons

Home Assistant Add-ons
Apache License 2.0
46 stars 14 forks source link

SQL Error on startup with a plain setup #19

Closed FireEmerald closed 1 year ago

FireEmerald commented 2 years ago

I've installed your "TimeScaleDb" add-on as described here on a pi4 - so far so good.

But taking a look at the Logs tab of the add-on is showing:

(...)
[00:22:29] INFO: Enabling PgAgent Extension..
NOTICE:  extension "pgagent" already exists, skipping
CREATE EXTENSION
[00:22:29] INFO: Starting PgAgent..
[00:22:29] INFO: Create database if not exist: 'homeassistant'
[00:22:29] INFO: done
[00:22:30] INFO: Enabling Timescale Extension for database: 'homeassistant'
CREATE EXTENSION
NOTICE:  extension "timescaledb" already exists, skipping
[00:22:30] INFO: Upgrading PostGIS for database: 'homeassistant'
2022-05-25 22:22:30.235 UTC [488] ERROR:  function postgis_extensions_upgrade() does not exist at character 8
2022-05-25 22:22:30.235 UTC [488] HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
2022-05-25 22:22:30.235 UTC [488] STATEMENT:  SELECT PostGIS_Extensions_Upgrade();
ERROR:  function postgis_extensions_upgrade() does not exist
LINE 1: SELECT PostGIS_Extensions_Upgrade();
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
[00:22:30] INFO: done
[00:22:30] NOTICE: TimescaleDb is running!

Is it intended or normal that the PostGIS_Extensions_Upgrade function is not found/does not exist?

FireEmerald commented 2 years ago

I think the error is shown because by default the PostGIS Extension is not created for the homeassistant database - had to execute manually CREATE EXTENSION postgis;. Shouldn't it be created by default for the databases added to the config section "timescale_enabled": ["homeassistant"],?

Expaso commented 1 year ago

Hi @FireEmerald ,

Yes, you are totally right! I will fix this! Thank you for your report!

Expaso commented 1 year ago

This issue is now fixed in the latest version of the addon. >= 2.1.0