Skip to content

SplitScriptIntoCommands incorrectly splits CREATE FUNCTION #42

Description

@VMelnalksnis

Is there an existing issue for this?

  • I have searched the existing issues

Library Version

6.1.5

What happened?

Looks like function bodies in CREATE FUNCTION are split into multiple statements, which causes it to fail due to invalid syntax. For example

CREATE FUNCTION identity.get_random() RETURNS double precision
    LANGUAGE sql
    IMMUTABLE STRICT PARALLEL SAFE
BEGIN ATOMIC
    SELECT random();
END;

is split into 2 statements

CREATE FUNCTION identity.get_random() RETURNS double precision
    LANGUAGE sql
    IMMUTABLE STRICT PARALLEL SAFE
BEGIN ATOMIC
    SELECT random()

and

END

If the function contains multiple statements, each is split into a separate statement as well.

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions