Skip to content

[Bug]: script splitting fails when script contains semicolons in backquote-enquoted strings #8592

@peterhalicky

Description

@peterhalicky

Module

Core

Testcontainers version

1.17.2

Using the latest Testcontainers version?

Yes

Host OS

MacOS

Host Arch

ARM

Docker version

Not relevant.

What happened?

I have a SQL script with the following statement:

create table `form;3`
(
    id           varchar(100),
    `first;name` varchar(100),
    `last;name`  varchar(100),
    primary key (id)
);

ScriptSplitter breaks this into multiple statements. Version 1.17.1 was not splitting it up, i.e. it remained a single statement.

Relevant log output

No response

Additional Information

Failing unit test:

    @Test
    public void testBacktickEnquotedSemicolon() {
        String script =
            "CREATE TABLE `bar;bar` (\n" +
            "  end_time VARCHAR(255)\n" +
            ");";

        List<String> expected = Arrays.asList(
            "CREATE TABLE `bar;bar` ( end_time VARCHAR(255) )"
        );

        splitAndCompare(script, expected);
    }

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