New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: alter table for compression has inconsistent/misleading error messages #4331
Comments
For compressed hypertables you cannot change the compression options. To change compression options you need to disable compression and set the new options when reenabling compression. |
From my understanding, I didn't change any compression options, as I executed exacly the same statement. From my understanding, the absence of timescaledb.compress_orderby has different behaviours. In the first execution, it considers the order by as the default option. But, in the following executions, it is being understood as null value. In other words, I expected same behaviour/settings by executing the two block of codes below in a a hypertable without any compression options enabled.
|
It is also possible to change options when the hypertable isn't compressed, but the options were previously set. These statements execute without problems:
It is also possible to change the segment column without disabling compression options:
Apparentely, the issue is only related to orderby, only when the parameter isn't stated explicitly in the alter table statement, because we were able to change all compression options without disabling it. Is this behavior expected? |
The default value for `timescaledb.compress_orderby` is time desc, so if nothing is specified we should treat it as the default value, and overwrite any previously set value with the default. Fixes timescale#4331
The default value for `timescaledb.compress_orderby` is time desc, so if nothing is specified we should treat it as the default value, and overwrite any previously set value with the default. Fixes timescale#4331
The default value for `timescaledb.compress_orderby` is time desc. If nothing is specified we should treat it as the default value, and overwrite any previously set value for this option with the default. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes timescale#4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes #4331
Hi @felipenogueirajack , sorry for the delay getting back to you about this issue. Yes, this behavior you noticed was indeed unexpected. The linked pull request should fix that, so the issue is closed. |
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes #4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes #4331
When enabling compression on a hypertable, the orderby option can be omitted, which will set the default value of "time DESC". However previously, when executing the same command twice not setting orderby, the second time we would get an error that orderby was previously set and must be specified. For example when executing `alter table set (timescaledb.compress, timescaledb.segmentby = '..')` The reason for that error was that it's unclear if no orderby means leave as is, or if it means set the default value. But in the case where orderby is already set to the default value, there is no ambiguity and both cases are equivalent, so the default value can be reset without giving an error. Fixes #4331
What type of bug is this?
Configuration
What subsystems and features are affected?
Compression, Configuration
What happened?
We witnessed inconsistent behavior regarding the default value of timescaledb.compress_orderby, when the same alter table statement to turn on compression and set compression options are executed more than once.
To reproduce the error:
ALTER TABLE events."abc_evt" set (timescaledb.compress=true , timescaledb.compress_segmentby = '"segment"');
ALTER TABLE events."abc_evt" set (timescaledb.compress=true , timescaledb.compress_segmentby = '"segment"');
The last command above throws the following error:
Note that in both statements we did not specified column to order by. Just to be clear, the column to segmentby has nothing do with the error, as it also happens when we executed the following statement twice:
The documentation states
timescaledb.compress_orderby
is an optional parameter and "The default is the descending order of the hypertable's time column." However, when we explicit specified the column to orderby in the statement, but using its default value, the error does not happen:In all cases above (with or without timescaledb.compress_orderby), the compression options/setting were the same. We checked using the statement and its result is show in the image below:
select * from timescaledb_information.compression_settings;
Trying to understand the error, we specified the time column as the column to segment by, by executing the following:
Even without the orderby parameter, executing the last statement twice, the error does not occur. In addition, the compression settings shows a different result:
In our understanding, as the column to order by is not specified in any execution, the settings should have been the same: for timestamp column, the column orderby_asc should be false and orderby_nullsfirst should be true, as this is default option. In addition, executing the compression setting without
timescaledb.compress_orderby
should have not thrown the stated error (as it does not occur when the default value is explicit used).TimescaleDB version affected
2.5.1
PostgreSQL version used
12.10
What operating system did you use?
Ubuntu 20.04.4 LTS
What installation method did you use?
Docker
What platform did you run on?
On prem/Self-hosted
Relevant log output and stack trace
ERROR: must specify a column to order by
DETAIL: The timescaledb.compress_orderby option was previously set and must also be specified in the updated configuration.
SQL state: 0A000
How can we reproduce the bug?
Described with details above, but to resume:
ALTER TABLE events."abc_evt" set (timescaledb.compress=true , timescaledb.compress_segmentby = '"segment"');
ALTER TABLE events."abc_evt" set (timescaledb.compress=true , timescaledb.compress_segmentby = '"segment"');
The text was updated successfully, but these errors were encountered: