Skip to content
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

Open
m3hm3t opened this issue Jan 13, 2025 · 0 comments

Comments

@m3hm3t
Copy link
Contributor

m3hm3t commented Jan 13, 2025

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

CREATE TABLE dist_sc_1.schema_based_sharding_1 (
    id INTEGER
);

-- Distributed table configuration
SELECT create_distributed_table('dist_sc_1.schema_based_sharding_1', 'id');

MERGE INTO dist_sc_1.schema_based_sharding_1 AS target_0
USING pg_catalog.pg_class AS ref_0
  INNER JOIN information_schema.check_constraints AS ref_1
  ON (
    CASE 
      WHEN 
        CASE 
          WHEN (ref_0.reltuples = (SELECT null_frac FROM pg_catalog.pg_stats LIMIT 1 OFFSET 4)) 
          OR (CAST(NULL AS xid8) >= CAST(NULL AS xid8)) 
          THEN CAST(NULL AS lseg) 
          ELSE CAST(NULL AS lseg) 
        END > CAST(NULL AS lseg) 
      THEN CAST(NULL AS jsonb) 
      ELSE CAST(NULL AS jsonb) 
    END 
    <= 
    CASE 
      WHEN FALSE OR FALSE 
      THEN CAST(NULL AS jsonb) 
      ELSE CAST(NULL AS jsonb) 
    END
  )
ON target_0.id = ref_0.relpages 
WHEN NOT MATCHED
  AND CAST(NULL AS circle) <@ CAST(NULL AS circle)
THEN DO NOTHING;

Schema Details

\d+ dist_sc_1.schema_based_sharding_1
                                Table "dist_sc_1.schema_based_sharding_1"
┌────────┬─────────┬───────────┬──────────┬─────────┬─────────┬─────────────┬──────────────┬─────────────┐
│ Column │  Type   │ Collation │ Nullable │ Default │ Storage │ Compression │ Stats target │ Description │
├────────┼─────────┼───────────┼──────────┼─────────┼─────────┼─────────────┼──────────────┼─────────────┤
│ id     │ integer │           │          │         │ plain   │             │              │             │
└────────┴─────────┴───────────┴──────────┴─────────┴─────────┴─────────────┴──────────────┴─────────────┘
Access method: heap

Crash Logs

2025-01-10 22:02:11.451 UTC [11846] LOG:  server process (PID 59459) was terminated by signal 6: Aborted
2025-01-10 22:02:11.451 UTC [11846] DETAIL:  Failed process was running: MERGE INTO dist_sc_1.schema_based_sharding_1 as target_0
        USING pg_catalog.pg_class as ref_0
          inner join information_schema.check_constraints as ref_1
          on (case when case when (ref_0.reltuples = (select null_frac from pg_catalog.pg_stats limit 1 offset 4)
                          ) 
                      or (cast(null as xid8) >= cast(null as xid8)) then cast(null as lseg) else cast(null as lseg) end
                     > cast(null as lseg) then cast(null as jsonb) else cast(null as jsonb) end
                 <= case when (false) 
                  or (false) then cast(null as jsonb) else cast(null as jsonb) end
                )
        ON target_0.id = ref_0.relpages 
        WHEN NOT MATCHED
          AND cast(null as circle) <@ cast(null as circle)
           THEN DO NOTHING

2025-01-10 22:02:11.451 UTC [11846] LOG:  terminating any other active server processes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant