timescaledb/test/sql/drop_rename_hypertable.sql
Matvey Arye 1f13354bf9 Make the planner use metadata cache
Previously, the planner used a direct query via the SPI interface to
retrieve metadata info needed for query planner functions like query
rewriting. This commit updates the planner to use our caching system.
This is a performance improvement for pretty much all operations,
both data modifications and queries.

For hypertables, this added a cache keyed by the main table OID and
added negative entries (because the planner often needs to know if a
table is /not/ a hypertable).
2017-03-13 14:18:33 -04:00

32 lines
677 B
SQL

\set ON_ERROR_STOP 1
\set VERBOSITY verbose
\set SHOW_CONTEXT never
\o /dev/null
\ir include/insert_two_partitions.sql
\o
\set ECHO ALL
\c single
\d+ "_timescaledb_internal".*
-- Test that renaming hypertable is blocked
\set VERBOSITY default
\set ON_ERROR_STOP 0
ALTER TABLE "testNs" 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 "testNs";
SELECT * FROM _timescaledb_catalog.hypertable;
\dt "public".*
\dt "_timescaledb_catalog".*
\dt+ "_timescaledb_internal".*