Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,9 @@ protected virtual Expression VisitRegexMatch(PgRegexMatchExpression expression,
// PG regexps are single-line by default
if (options == RegexOptions.Singleline)
{
Sql.Append("(");
Visit(expression.Pattern);
Sql.Append(")");
Comment thread
fritz3n marked this conversation as resolved.
return expression;
}

Expand Down Expand Up @@ -1011,9 +1013,9 @@ protected virtual Expression VisitRegexMatch(PgRegexMatchExpression expression,

if (constantPattern is null)
{
Sql.Append("' || ");
Sql.Append("' || (");
Visit(expression.Pattern);
Sql.Append(")");
Sql.Append("))");
Comment thread
fritz3n marked this conversation as resolved.
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ await AssertQuery(

SELECT c."CustomerID", c."Address", c."City", c."CompanyName", c."ContactName", c."ContactTitle", c."Country", c."Fax", c."Phone", c."PostalCode", c."Region"
FROM "Customers" AS c
WHERE c."CompanyName" ~ ('(?p)' || @pattern)
WHERE c."CompanyName" ~ ('(?p)' || (@pattern))
""");
}

Expand Down Expand Up @@ -197,7 +197,7 @@ await AssertQuery(
"""
SELECT c."CustomerID", c."Address", c."City", c."CompanyName", c."ContactName", c."ContactTitle", c."Country", c."Fax", c."Phone", c."PostalCode", c."Region"
FROM "Customers" AS c
WHERE c."CompanyName" ~ '^A'
WHERE c."CompanyName" ~ ('^A')
""");
}

Expand All @@ -213,7 +213,7 @@ await AssertQuery(
"""
SELECT c."CustomerID", c."Address", c."City", c."CompanyName", c."ContactName", c."ContactTitle", c."Country", c."Fax", c."Phone", c."PostalCode", c."Region"
FROM "Customers" AS c
WHERE c."CompanyName" ~* '^a'
WHERE c."CompanyName" ~* ('^a')
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ public override async Task Regex_IsMatch_constant_input()
"""
SELECT b."Id", b."Bool", b."Byte", b."ByteArray", b."DateOnly", b."DateTime", b."DateTimeOffset", b."Decimal", b."Double", b."Enum", b."FlagsEnum", b."Float", b."Guid", b."Int", b."Long", b."Short", b."String", b."TimeOnly", b."TimeSpan"
FROM "BasicTypesEntities" AS b
WHERE 'Seattle' ~ ('(?p)' || b."String")
WHERE 'Seattle' ~ ('(?p)' || (b."String"))
""");
}

Expand Down