Skip to content

Incorrect parse of SQL file with double semicolon #138

@jaroslavtyc

Description

@jaroslavtyc

Symfony messenger generated following SQL migration for PostgreSQL

CREATE
OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS
$$
BEGIN
    PERFORM
pg_notify('messenger_messages', NEW.queue_name::text);
RETURN NEW;
END;
$$
LANGUAGE plpgsql;;
DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;;
CREATE TRIGGER notify_trigger
    AFTER INSERT OR
UPDATE
    ON messenger_messages
    FOR EACH ROW
    EXECUTE PROCEDURE notify_messenger_messages();;

\Nextras\Migrations\Drivers\BaseDriver::loadFile parse it incorrectly considering as a valid delimiter only single ;, which results into empty SQL command

$q = substr($content, $queryOffset, $queryLength); // $q = ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions