diff --git a/config.yaml b/config.yaml index 5d8676feba..e157d81231 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/metadata.yaml b/metadata.yaml index 5f429a40b2..d2a42f663e 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -28,7 +28,7 @@ resources: postgresql-image: type: oci-image description: OCI image for PostgreSQL - upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:31cf150b4523481202c1ff9b7b5d7f0b36729edad89d61242d8f1eb56b2912c0 + upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:76ef26c7d11a524bcac206d5cb042ebc3c8c8ead73fa0cd69d21921552db03b6 peers: database-peers: diff --git a/src/config.py b/src/config.py index 3cc459289c..0a26556747 100644 --- a/src/config.py +++ b/src/config.py @@ -84,6 +84,7 @@ class CharmConfig(BaseConfigModel): plugin_postgis_topology_enable: bool plugin_postgis_raster_enable: bool plugin_vector_enable: bool + plugin_timescaledb_enable: bool request_date_style: Optional[str] request_standard_conforming_strings: Optional[bool] request_time_zone: Optional[str] diff --git a/templates/patroni.yml.j2 b/templates/patroni.yml.j2 index 2d4ee5f92f..0ef6ec2c5e 100644 --- a/templates/patroni.yml.j2 +++ b/templates/patroni.yml.j2 @@ -40,6 +40,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 753faa4e7a..9130b0c2ac 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) @@ -146,9 +149,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):