citusdata / citusdata/citus

Add IF NOT EXISTS logic to create_distributed_table()

Open
#4,942 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

In a current implementation `create_distributed_table()` returns error if table is already created and distributed. It makes difficult to implement scenario with dynamic idempotent table creation, e.g.

```sql
CREATE TABLE IF NOT EXISTS new_table
(
user_id VARCHAR,
time timestamptz,
data jsonb
);
SELECT create_distributed_table('new_table', 'user_id');
```

It would be nice to have an ability to disable the error via a parameter or another function like `create_if_not_exists_distributed_table()`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.