Skip to content

Migrations break when a BEGIN ATOMIC statement includes CASE #3474

Open
@icopp

Description

@icopp

Describe the bug
When a migration contains a BEGIN ATOMIC function that includes CASE ... END, the migration fails with syntax error at end of input (SQLSTATE 42601).

To Reproduce
Steps to reproduce the behavior:

  1. Create a new migration with a function like
    CREATE FUNCTION test RETURNS BOOLEAN LANGUAGE sql 
    BEGIN ATOMIC 
    SELECT CASE
        WHEN TRUE THEN TRUE
        ELSE FALSE
    END;
    END;
    
  2. Attempt to run the migration

Expected behavior
The migration should succeed.

Screenshots
n/a

System information
Rerun the failing command with --create-ticket flag.

  • Ticket ID: 629e9f7399a14614a7d2a5a7233f4729
  • Version of OS: macOS 15.4
  • Version of CLI: 2.20.12
  • Version of Docker: 27.5.1
  • Versions of services:
    supabase/postgres      | 15.8.1.060       | -      
    supabase/gotrue        | v2.170.0         | -      
    postgrest/postgrest    | v12.2.8          | -      
    supabase/realtime      | v2.34.45         | -      
    supabase/storage-api   | v1.19.3          | -      
    supabase/edge-runtime  | v1.67.4          | -      
    supabase/studio        | 20250317-6955350 | -      
    supabase/postgres-meta | v0.88.2          | -      
    supabase/logflare      | 1.12.0           | -      
    supabase/supavisor     | 2.4.14           | -  
    ```
    
    

Additional context
If applicable, add any other context about the problem here.

  • Version of Node.js: v22.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions