Skip to content

Remove finalized parameter from schema dump and CREATE statement#128

Merged
josesahad merged 2 commits intotimescale:masterfrom
stevehill1981:fix/remove-finalized-parameter-from-schema-dump
Feb 9, 2026
Merged

Remove finalized parameter from schema dump and CREATE statement#128
josesahad merged 2 commits intotimescale:masterfrom
stevehill1981:fix/remove-finalized-parameter-from-schema-dump

Conversation

@stevehill1981
Copy link
Contributor

Problem

The timescaledb.finalized parameter was removed in TimescaleDB 2.14+ where all continuous aggregates are finalized by default. When using this gem with TimescaleDB 2.14+, loading a schema that includes finalized: true causes an error:

PG::InvalidParameterValue: ERROR: unrecognized parameter "timescaledb.finalized"

This affects both:

  1. Schema dumps that include finalized: true
  2. Migrations that pass finalized: true to create_continuous_aggregate

Solution

  • Only output finalized: false in schema dumps (for legacy compatibility with 2.7-2.13)
  • Only include timescaledb.finalized=false in CREATE statements
  • Omit the parameter when true (the default) to support TimescaleDB 2.14+

This maintains backward compatibility with TimescaleDB 2.7-2.13 for users who still have legacy (non-finalized) continuous aggregates, while fixing the error on 2.14+.

Changes

  • lib/timescaledb/schema_dumper.rb - Only output finalized: false when explicitly false
  • lib/timescaledb/migration_helpers.rb - Only include finalized clause when explicitly false
  • Updated tests to reflect new behavior

References

The `timescaledb.finalized` parameter was removed in TimescaleDB 2.14+
where all continuous aggregates are finalized by default. Including this
parameter causes an error on newer versions:

  PG::InvalidParameterValue: ERROR: unrecognized parameter "timescaledb.finalized"

This change:
- Only outputs `finalized: false` in schema dumps (for legacy compatibility)
- Only includes `timescaledb.finalized=false` in CREATE statements
- Omits the parameter when true (the default) to support TimescaleDB 2.14+

This maintains backward compatibility with TimescaleDB 2.7-2.13 for users
who still have legacy (non-finalized) continuous aggregates.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@CLAassistant
Copy link

CLAassistant commented Jan 29, 2026

CLA assistant check
All committers have signed the CLA.

@lethaale
Copy link

lethaale commented Feb 2, 2026

For those who come here looking for a solution, I reported the problem to support and they are taking care of this

@@ -178,15 +177,30 @@
end

context 'when overriding WITH clause timescaledb.finalized' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is failing when running the tests, not sure if we should keep it.

@josesahad
Copy link
Contributor

Hi @stevehill1981, thank you very much for the PR!
I added a comment; I see one test failing, but not sure if we should keep that logic with these changes.

@josesahad josesahad merged commit 25224db into timescale:master Feb 9, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants