timescaledb/test/sql/plain.sql
Erik Nordström 4a0a0d8253 Fix column type change on plain tables
A recent change blocked changing types of space-partitioned hypertable
columns. However, this blocking should not apply to regular tables,
which otherwise causes a crash. This change fixes this issue by
properly checking that the the table is a hypertable.
2017-10-30 14:54:37 +01:00

28 lines
884 B
SQL

-- Tests for plain PostgreSQL commands to ensure that they work while
-- the TimescaleDB extension is loaded. This is a mix of statements
-- added mostly as regression checks when bugs are discovered and
-- fixed.
CREATE TABLE regular_table(time timestamp, temp float8, tag text, color integer);
-- Renaming indexes should work
CREATE INDEX time_color_idx ON regular_table(time, color);
ALTER INDEX time_color_idx RENAME TO time_color_idx2;
ALTER TABLE regular_table ALTER COLUMN color TYPE bigint;
\d+ regular_table
-- Renaming types should work
CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple');
ALTER TYPE rainbow RENAME TO colors;
\dT+
REINDEX TABLE regular_table;
\c single :ROLE_SUPERUSER
REINDEX SCHEMA public;
-- Not only simple statements should work
CREATE TABLE a (aa TEXT);
CREATE TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a);