citusdata / citusdata/citus

Incorrectly setting parallel access mode

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

Description

When we have a query like the following:

```sql
BEGIN;
SELECT COUNT(*) FROM dist_table;
TRUNCATE ref_table CASCADE;
COMMIT;
```

We get this output:

```sql
BEGIN;
SELECT COUNT(*) FROM dist_table;
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500001 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500004 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500007 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500010 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500013 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500016 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500019 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500022 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500025 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500028 dist_table WHERE true
NOTICE: executing the command locally: SELECT count(*) AS count FROM local_commands_test_schema.dist_table_1500031 dist_table WHERE true
count
---------------------------------------------------------------------
0
(1 row)

TRUNCATE ref_table CASCADE;
NOTICE: truncate cascades to table "dist_table"
NOTICE: executing the command locally: TRUNCATE TABLE local_commands_test_schema.ref_table_xxxxx CASCADE
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
NOTICE: truncate cascades to table "dist_table_xxxxx"
ERROR: cannot execute DDL on reference table "ref_table" because there was a parallel SELECT access to distributed table "dist_table" in the same transaction
COMMIT;
```

so we get an error in truncate saying

>-ERROR: cannot execute DDL on reference table "ref_table" because there was a parallel SELECT access to distributed table "dist_table" in the same transaction

However, the select is not run in parallel, it is run with local execution therefore it is sequential. We should be able to execute truncate without an error in this case.

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.