Matvey Arye d2b4b6e22e Add remote transaction ID module
The remote transaction ID is used in two phase commit. It is the
identifier sent to the datanodes in PREPARE TRANSACTION and related
postgresql commands.

This is the first in a series of commits for adding two phase
commit support to our distributed txn infrastructure.
2020-05-27 17:31:09 +02:00

50 lines
2.6 KiB
Plaintext

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
-- 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;
SELECT * FROM test.show_columns('regular_table');
Column | Type | NotNull
--------+-----------------------------+---------
time | timestamp without time zone | f
temp | double precision | f
tag | text | f
color | bigint | f
(4 rows)
SELECT * FROM test.show_indexes('regular_table');
Index | Columns | Expr | Unique | Primary | Exclusion | Tablespace
-----------------+--------------+------+--------+---------+-----------+------------
time_color_idx2 | {time,color} | | f | f | f |
(1 row)
-- Renaming types should work
CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple');
ALTER TYPE rainbow RENAME TO colors;
\dT+
List of data types
Schema | Name | Internal name | Size | Elements | Owner | Access privileges | Description
--------+--------+---------------+------+----------+-------------------+-------------------+-------------
public | colors | colors | 4 | red +| default_perm_user | |
| | | | orange +| | |
| | | | yellow +| | |
| | | | green +| | |
| | | | blue +| | |
| | | | purple | | |
public | rxid | rxid | 16 | | super_user | |
(2 rows)
REINDEX TABLE regular_table;
\c :TEST_DBNAME :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);