timescaledb/test/sql/drop_rename_hypertable.sql
Matvey Arye bfe58b61f7 Refactor towards supporting version upgrades
Clean up the table schema to get rid of legacy tables and functionality
that makes it more difficult to provide an upgrade path.

Notable changes:
* Get rid of legacy tables and code
* Simplify directory structure for SQL code
* Simplify table hierarchy: remove root table and make chunk tables
* inherit directly from main table
* Change chunk table suffix from _data to _chunk
* Simplify schema usage: _timescaledb_internal for internal functions.
* _timescaledb_catalog for metadata tables.
* Remove postgres_fdw dependency
* Improve code comments in sql code
2017-06-08 13:55:05 -04:00

26 lines
608 B
SQL

\o /dev/null
\ir include/insert_two_partitions.sql
\o
\d+ "_timescaledb_internal".*
-- Test that renaming hypertable is blocked
\set VERBOSITY default
\set ON_ERROR_STOP 0
ALTER TABLE "two_Partitions" RENAME TO "newname";
\set ON_ERROR_STOP 1
-- Test that renaming ordinary table works
CREATE TABLE renametable (foo int);
ALTER TABLE "renametable" RENAME TO "newname";
SELECT * FROM "newname";
SELECT * FROM _timescaledb_catalog.hypertable;
DROP TABLE "two_Partitions" CASCADE;
SELECT * FROM _timescaledb_catalog.hypertable;
\dt "public".*
\dt "_timescaledb_catalog".*
\dt+ "_timescaledb_internal".*