Skip to content

Compression policy fails if the table uses integer and not bigint #3773

Closed
@CaptainCuddleCube

Description

Relevant system information:

  • OS: Ubuntu 18.04.5
  • PostgreSQL PostgreSQL 12.8
  • TimescaleDB version 2.5.0
  • Installation method: AWS Image

Describe the bug

The show_chunks function's older_than argument needs the data to be the same type as the time column.

However, in the _timescaledb_internal.policy_compression_integer function, it casts values to BIGINT. So if your time column is an INT, the compression policy will fail.

In the below code link, the lag_integer value is a BIGINT.

FROM show_chunks( htoid, older_than => lag_integer) SHOW (oid)

To Reproduce
Create a table with an INTEGER time column, use set_integer_now_func to set the function type, and then add a compression policy.

You will start seeing errors in the logs:

2021-11-02 11:19:30.087 UTC [12436] ERROR:  invalid time argument type "bigint"
2021-11-02 11:19:30.087 UTC [12436] HINT:  Try casting the argument to "integer".
2021-11-02 11:19:30.087 UTC [12436] CONTEXT:  PL/pgSQL function _timescaledb_internal.policy_compression_integer(integer,integer,bigint,integer,boolean,boolean) line 17 at FOR over SELECT rows
	SQL statement "CALL _timescaledb_internal.policy_compression_integer(
	            job_id, htid, lag_integer,
	            maxchunks, verbose_log, recompress_enabled )"
	PL/pgSQL function _timescaledb_internal.policy_compression(integer,jsonb) line 62 at CALL

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions