diff --git a/config.yaml b/config.yaml index 35617edbab..89af90fc71 100644 --- a/config.yaml +++ b/config.yaml @@ -299,6 +299,10 @@ options: default: false type: boolean description: Enable pgvector extension + plugin_timescaledb_enable: + default: false + type: boolean + description: Enable timescaledb extension profile: description: | Profile representing the scope of deployment, and used to tune resource allocation. diff --git a/src/config.py b/src/config.py index c8196b46ba..a472921ec2 100644 --- a/src/config.py +++ b/src/config.py @@ -79,6 +79,7 @@ class CharmConfig(BaseConfigModel): plugin_icu_ext_enable: bool plugin_pltcl_enable: bool plugin_postgis_enable: bool + plugin_timescaledb_enable: bool plugin_address_standardizer_enable: bool plugin_address_standardizer_data_us_enable: bool plugin_postgis_tiger_geocoder_enable: bool diff --git a/src/constants.py b/src/constants.py index fd42e0e247..3dbfc24ef9 100644 --- a/src/constants.py +++ b/src/constants.py @@ -36,7 +36,7 @@ SNAP_PACKAGES = [ ( POSTGRESQL_SNAP_NAME, - {"revision": {"aarch64": "112", "x86_64": "113"}, "channel": "14/stable"}, + {"revision": {"aarch64": "114", "x86_64": "115"}, "channel": "14/stable"}, ) ] diff --git a/templates/patroni.yml.j2 b/templates/patroni.yml.j2 index 1a12292807..64c00381f7 100644 --- a/templates/patroni.yml.j2 +++ b/templates/patroni.yml.j2 @@ -91,6 +91,7 @@ bootstrap: log_truncate_on_rotation: 'on' logging_collector: 'on' wal_level: logical + shared_preload_libraries: 'timescaledb' {%- if pg_parameters %} {%- for key, value in pg_parameters.items() %} {{key}}: {{value}} diff --git a/tests/integration/test_plugins.py b/tests/integration/test_plugins.py index ce395469a9..5d78dcd3aa 100644 --- a/tests/integration/test_plugins.py +++ b/tests/integration/test_plugins.py @@ -78,11 +78,14 @@ ADDRESS_STANDARDIZER_EXTENSION_STATEMENT = "SELECT num, street, city, zip, zipplus FROM parse_address('1 Devonshire Place, Boston, MA 02109-1234');" ADDRESS_STANDARDIZER_DATA_US_EXTENSION_STATEMENT = "SELECT house_num, name, suftype, city, country, state, unit FROM standardize_address('us_lex', 'us_gaz', 'us_rules', 'One Devonshire Place, PH 301, Boston, MA 02109');" POSTGIS_TIGER_GEOCODER_EXTENSION_STATEMENT = "SELECT * FROM standardize_address('tiger.pagc_lex', 'tiger.pagc_gaz', 'tiger.pagc_rules', 'One Devonshire Place, PH 301, Boston, MA 02109-1234');" -POSTGIS_TOPOLOGY_STATEMENT = "SELECT topology.CreateTopology('nyc_topo', 26918, 0.5);" -POSTGIS_RASTER_STATEMENT = "CREATE TABLE test_postgis_raster (name varchar, rast raster);" +POSTGIS_TOPOLOGY_EXTENSION_STATEMENT = "SELECT topology.CreateTopology('nyc_topo', 26918, 0.5);" +POSTGIS_RASTER_EXTENSION_STATEMENT = ( + "CREATE TABLE test_postgis_raster (name varchar, rast raster);" +) VECTOR_EXTENSION_STATEMENT = ( "CREATE TABLE vector_test (id bigserial PRIMARY KEY, embedding vector(3));" ) +TIMESCALEDB_EXTENSION_STATEMENT = "CREATE TABLE test_timescaledb (time TIMESTAMPTZ NOT NULL); SELECT create_hypertable('test_timescaledb', 'time');" @pytest.mark.group(1) @@ -153,9 +156,10 @@ async def test_plugins(ops_test: OpsTest) -> None: "plugin_address_standardizer_enable": ADDRESS_STANDARDIZER_EXTENSION_STATEMENT, "plugin_address_standardizer_data_us_enable": ADDRESS_STANDARDIZER_DATA_US_EXTENSION_STATEMENT, "plugin_postgis_tiger_geocoder_enable": POSTGIS_TIGER_GEOCODER_EXTENSION_STATEMENT, - "plugin_postgis_raster_enable": POSTGIS_RASTER_STATEMENT, - "plugin_postgis_topology_enable": POSTGIS_TOPOLOGY_STATEMENT, + "plugin_postgis_raster_enable": POSTGIS_RASTER_EXTENSION_STATEMENT, + "plugin_postgis_topology_enable": POSTGIS_TOPOLOGY_EXTENSION_STATEMENT, "plugin_vector_enable": VECTOR_EXTENSION_STATEMENT, + "plugin_timescaledb_enable": TIMESCALEDB_EXTENSION_STATEMENT, } def enable_disable_config(enabled: False): diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py index 48907eb4d0..7370788179 100644 --- a/tests/unit/test_charm.py +++ b/tests/unit/test_charm.py @@ -530,6 +530,9 @@ def test_enable_disable_extensions(harness, caplog): plugin_vector_enable: default: false type: boolean + plugin_timescaledb_enable: + default: false + type: boolean profile: default: production type: string"""