Skip to content
Snippets Groups Projects
Commit fce28f44 authored by Arseniy Volynets's avatar Arseniy Volynets Committed by Denis Smirnov
Browse files

feat: allow create global table through sql

parent 36602d9a
No related branches found
No related tags found
1 merge request!668feat: allow create global table through sql
Pipeline #25150 passed
......@@ -57,6 +57,8 @@ with the `YY.0M.MICRO` scheme.
- _Clusterwide SQL_ introduces the capability to drop picodata users.
- _Clusterwide SQL_ introduces the capability to create roles.
- _Clusterwide SQL_ now allows creation of a global table through
`create table`.
### Lua API:
......
......@@ -257,12 +257,17 @@ fn reenterable_ddl_request(
is_nullable: f.is_nullable,
})
.collect();
let distribution = if sharding_key.is_some() {
DistributionParam::Sharded
} else {
DistributionParam::Global
};
let params = CreateSpaceParams {
id: None,
name,
format,
primary_key,
distribution: DistributionParam::Sharded,
distribution,
by_field: None,
sharding_key,
sharding_fn: Some(ShardingFn::Murmur3),
......
......@@ -238,6 +238,29 @@ def test_create_drop_table(cluster: Cluster):
)
assert ddl["row_count"] == 1
# Check global space
ddl = i1.sql(
"""
create table "global_t" ("key" string not null, "value" string not null,
primary key ("key"))
using memtx
distributed globally
option (timeout = 3)
"""
)
assert ddl["row_count"] == 1
with pytest.raises(ReturnError, match="global spaces can use only memtx engine"):
i1.sql(
"""
create table "t" ("key" string not null, "value" string not null,
primary key ("key"))
using vinyl
distributed globally
option (timeout = 3)
"""
)
def test_insert_on_conflict(cluster: Cluster):
cluster.deploy(instance_count=1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment