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]: Failed to add a column in a hypertable #4087
Comments
@krvajal This error comes from the compression subsystem. Could you please add the hypertable definition and the call to |
We have the same problem with compressed hypertables. TimescaleDB version affected Our table looks something like this: (I omitted other columns for simplicity ).
|
@patrickFuerst @krvajal Thank you for the bug report, it was straightforward to reproduce. foo=# \dx
List of installed extensions
Name | Version | Schema | Description
-------------+-----------+------------+-------------------------------------------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
timescaledb | 2.6.0-dev | public | Enables scalable inserts and complex queries for time-series data
(2 rows)
foo=# CREATE TABLE metric (time TIMESTAMPTZ NOT NULL, val FLOAT8 NOT NULL, dev_id INT4 NOT NULL);
CREATE TABLE
foo=# SELECT create_hypertable('metric', 'time', 'dev_id', 10);
create_hypertable
---------------------
(1,public,metric,t)
(1 row)
foo=# ALTER TABLE metric SET (
timescaledb.compress,
timescaledb.compress_segmentby = 'dev_id',
timescaledb.compress_orderby = 'time DESC'
);
ALTER TABLE
foo=# INSERT INTO metric(time, val, dev_id)
SELECT s.*, 3.14+1, 1
FROM generate_series('2021-08-17 00:00:00'::timestamp,
'2021-08-17 00:02:00'::timestamp, '1 s'::interval) s;
INSERT 0 121
foo=# SELECT compress_chunk(show_chunks('metric'));
compress_chunk
----------------------------------------
_timescaledb_internal._hyper_1_1_chunk
(1 row)
foo=# ALTER TABLE metric ADD COLUMN IF NOT EXISTS "medium" VARCHAR ;
ALTER TABLE
foo=# ALTER TABLE metric ADD COLUMN IF NOT EXISTS "medium" VARCHAR ;
NOTICE: column "medium" of relation "metric" already exists, skipping
ERROR: column "medium" of relation "_compressed_hypertable_2" already exists |
When an ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... command is executed and the column already exists, we get an error message that the column already exists on the compressed hypertable, even though IF NOT EXISTS is specified. This PR removes this error. Fix timescale#4087
When an ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... command is executed and the column already exists, we get an error message that the column already exists on the compressed hypertable, even though IF NOT EXISTS is specified. This PR removes this error. Fix timescale#4087
When an ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... command is executed and the column already exists, we get an error message that the column already exists on the compressed hypertable, even though IF NOT EXISTS is specified. This PR removes this error. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix #4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix timescale#4087
Stop throwing exception with message "column of relation already exists" when running the command ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... on compressed hypertables. Fix #4087
What type of bug is this?
Unexpected error
What subsystems and features are affected?
Distributed hypertable
What happened?
When trying to add a column to an hypertable
and if the column already exists.
I get the following error
TimescaleDB version affected
2.5.0
PostgreSQL version used
14.1
What operating system did you use?
What installation method did you use?
Not applicable
What platform did you run on?
Managed Service for TimescaleDB (MST/Aiven)
Relevant log output and stack trace
How can we reproduce the bug?
The text was updated successfully, but these errors were encountered: