rept
rept

Reputation: 2236

Function add_compression_policy not found with TimescaleDB

I am running the latest version of TimescaleDB.

In the docs I found this: https://docs.timescale.com/latest/using-timescaledb/compression#quick-start

When I run:

CREATE TABLE con_details (LIKE deprecated_consumption_details INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES);
    
SELECT create_hypertable('con_details', 'date');
    
ALTER TABLE con_details SET (
  timescaledb.compress,
  timescaledb.compress_segmentby = 'meter_id'
);
    
SELECT add_compression_policy('con_details', INTERVAL '7 days');

the last line is throwing an error:

SQL Error [42883]: ERROR: function add_compression_policy(unknown, interval) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Position: 9

Also other functions that are in the docs such as:

SELECT * FROM hypertable_detailed_size('con_details');

are giving me errors:

ERROR: function hypertable_detailed_size(unknown) does not exist

The TimescaleDB extension is of course enabled (creating and querying a Hypertable works fine...)

Upvotes: 2

Views: 1961

Answers (1)

k_rus
k_rus

Reputation: 3219

In short, add_compression_policy is in the API of TimescaleDB 2.0, while earlier versions, e.g., 1.7.4 have add_compress_chunks_policy. And hypertable_detailed_size doesn't exist prior 2.0.

TimescaleDB 2.0, which is the latest release since December 21, introduces number of breaking changes in its API and policies are affected considerably. For example, add_compress_chunks_policy is renamed into add_compression_policy and its arguments are renamed too.

The documentation shows latest API by default, while many users are likely to use 1.7, which requires to use different version of documentation. Timescale docs page allow to chose a version of documentation corresponding to major TimescaleDB version:

Documnetation versions

Upvotes: 3

Related Questions