-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PG17 - SQLSmith - Server Crash Due to MERGE
Command on Distributed Table with Schema-Based Sharding
#7846
Labels
Comments
|
|
the error originates from this assertion in PostgreSQL 17's source code:
The issue here seems to stem from the PostgreSQL planner's handling of the MERGE statement rather than any interaction with Citus or distributed table logic. Since the crash occurs even with a non-distributed table, it indicates a potential bug in PostgreSQL's query planning logic for MERGE statements. |
|
|
m3hm3t
added a commit
that referenced
this issue
Jan 21, 2025
This pull request addresses Issue #7846, where specific MERGE queries on non-distributed and distributed tables can result in crashes in certain scenarios. The issue stems from the usage of `pg_class` catalog table, and the `FilterShardsFromPgclass` function in Citus. This function goes through the query's jointree to hide the shards. However, in PG17, MERGE's join quals are in a separate structure called `mergeJoinCondition`. Therefore FilterShardsFromPgclass was not filtering correctly in a `MERGE` command that involves `pg_class`. To fix the issue, we handle `mergeJoinCondition` separately in PG17. Relevant PG commit: postgres/postgres@0294df2 **Non-Distributed Tables:** A MERGE query involving a non-distributed table using `pg_catalog.pg_class` as the source may execute successfully but needs testing to ensure stability. **Distributed Tables:** Performing a MERGE on a distributed table using `pg_catalog.pg_class` as the source raises an error: `ERROR: MERGE INTO a distributed table from Postgres table is not yet supported` However, in some cases, this can lead to a server crash if the unsupported operation is not properly handled. This is the test output from the same test conducted prior to the code changes being implemented. ``` -- Issue #7846: Test crash scenarios with MERGE on non-distributed and distributed tables -- Step 1: Connect to a worker node to verify shard visibility \c postgresql://postgres@localhost::worker_1_port/regression?application_name=psql SET search_path TO pg17; -- Step 2: Create and test a non-distributed table CREATE TABLE non_dist_table_12345 (id INTEGER); -- Test MERGE on the non-distributed table MERGE INTO non_dist_table_12345 AS target_0 USING pg_catalog.pg_class AS ref_0 ON target_0.id = ref_0.relpages WHEN NOT MATCHED THEN DO NOTHING; SSL SYSCALL error: EOF detected connection to server was lost ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Executing a
MERGE
command on a distributed table (dist_sc_1.schema_based_sharding_1
) caused the PostgreSQL server to crash with signal 6: Aborted, forcing the termination of active server processes.Steps to Reproduce
Schema Details
Crash Logs
The text was updated successfully, but these errors were encountered: