diff --git a/src/Tests/PostgresqlQueryParserTests.cs b/src/Tests/PostgresqlQueryParserTests.cs index bd61b9c..6bde0d1 100644 --- a/src/Tests/PostgresqlQueryParserTests.cs +++ b/src/Tests/PostgresqlQueryParserTests.cs @@ -47,6 +47,23 @@ LANGUAGE PLPGSQL AS 'text'; SELECT '1' """, 2)] + [InlineData(""" + START TRANSACTION; + + DO $EF$ + BEGIN + INSERT INTO "AspNetUsers" ("Id", "UserName") + VALUES ('65fe2157-3214-4de5-8664-2648b67c530e', 'John'); + END $EF$; + + DO $EF$ + BEGIN + INSERT INTO "AspNetUsers" ("Id", "UserName") + VALUES ('7cc03149-09e9-42eb-9554-d3ce3bed15bd', 'Jane'); + END $EF$; + + COMMIT; + """, 4)] public void split_into_statements(string sql, int statementCount, params string[] expected) { var results = ParseCommand(sql); diff --git a/src/dbup-postgresql/PostgresqlQueryParser.cs b/src/dbup-postgresql/PostgresqlQueryParser.cs index 1c2ade5..aff26c0 100644 --- a/src/dbup-postgresql/PostgresqlQueryParser.cs +++ b/src/dbup-postgresql/PostgresqlQueryParser.cs @@ -239,7 +239,6 @@ public static IReadOnlyCollection ParseRawQuery( goto Finish; } - pos += dollarTagEnd + 1; // If the substring is found adjust the position to be relative to the entire string currCharOfs = pos + dollarTagEnd - dollarTagStart + 2; ch = '\0'; goto None;