ALTER SYSTEM LimitationsALTER TABLE
LimitationsCREATE TABLE
LimitationsDROP TABLE
LimitationsCREATE INDEX CONCURRENTLY
LimitationsUPDATE
LimitationsINSERT ON CONFLICT DO UPDATE
LimitationsALTER SCHEMA
LimitationsDROP SERVER
LimitationsTo ensure consistency of a sharded database, Shardman imposes some restrictions on SQL commands executed.
ALTER SYSTEM Limitations
ALTER SYSTEM is prohibited (configuration changes should be
performed via shardmanctl update).
ALTER TABLE
Limitations
ALTER TABLE is prohibited for partitions of sharded tables.
All forms of ALTER TABLE are prohibited for sharded or
global tables except these:
ALTER TABLE OWNER is allowed. For sharded table it
also changes the owner of table partitions. Only the global user
can be an owner of sharded or global table.
ADD COLUMN and DROP COLUMN are
allowed except adding columns of small serial types (
SMALLSERIAL, SERIAL2, SERIAL
and SERIAL4). SERIAL8 and
BIGSERIAL are supported, however.
Adding or dropping table-wide unique constraints and checks is allowed. For global tables dropping primary key constraint or dropping columns, participating in primary key, is forbidden.
Adding foreign keys between sharded tables is possible only when they are colocated and a foreign key references tuples, which are stored in the same replication group. A foreign key on a global table can reference only another global table. A foreign key on a sharded table can reference a colocated sharded table or a global table.
SET/DROP NOT NULL is allowed.
Setting storage options is allowed for global tables.
CREATE TABLE
Limitations All limitations for ALTER TABLE apply.
Only the global user can create sharded or global table.
A temporary table cannot be created as sharded or global.
DROP TABLE
LimitationsSharded or global tables and local tables cannot be dropped in the same statement.
Partitions of a sharded table cannot be dropped.
CREATE INDEX CONCURRENTLY
Limitations
CREATE INDEX CONCURRENTLY is a non-transactional command. If
a problem arises while building index on sharded or global tabe, such as network
failure, deadlock or a uniqueness violation in a unique index, the CREATE
INDEX CONCURRENTLY will partially fail, but can leave behind valid or
invalid indexes on Shardman cluster nodes. Also an
index can be completely missing on some nodes. In the later case DROP
INDEX will fail to drop the index. The recommended way to remove such
index cluster-wide is to use DROP INDEX IF EXISTS command.
Note that DROP INDEX CONCURRENTLY is not supported on sharded
tables, so this operation should be better performed in a maintenance window.
UPDATE
Limitations
UPDATE of a sharded table is executed as a series of usual
UPDATEs if it doesn't move data between partitions or subpartitions. Otherwise
it is executed internally as DELETE from one partition and
INSERT into another (so called target partition). If a partition where
UPDATE INSERTs data, is going to be UPDATED in the same statement, an
error will be raised. In practice this means that if UPDATE
moves data between partitions, you should explicitly exclude target partition
from updating in WHERE clause of the statement.
INSERT ON CONFLICT DO UPDATE
Limitations
INSERT INTO
command is not supported on foreign tables when conflict_target is table_name...
ON CONFLICT [conflict_target] conflict_action [WHERE condition]DO
UPDATE. For sharded tables it is supported if expressions in
SET and WHERE clause can be safely deparsed
(currently deparsing of sqlvalue-functions, parameters and subqueries inside
these clauses is not supported) and a non-partial unique index, containing only
table columns, corresponds to conflict_target expression. This is usually the
case with table's primary key.
Global users can be created only by user with CREATEROLE
permission on all cluster nodes.
Global roles cannot be renamed.
Global and local roles cannot be dropped in the same statement.
GRANT
to a local and global
role in the same statement is prohibited.
REVOKE
from a local and
global role in the same statement is prohibited.
ALTER SCHEMA
Limitations Schemas containing global or sharded tables cannot be renamed.
Shardman service schemas (shardman and
shardman_internal) cannot be renamed or dropped.
DROP SERVER
LimitationsShardman cluster servers cannot be dropped. Use Shardman tools to remove servers from the cluster.
DROP TYPE CASCADE
is
prohibited if it affects types used in global or sharded tables.