Skip to content

Commit 718b939

Browse files
authored
Fix PgTableValuedFunctionExpression cloning (#3026)
Fixes #3023
1 parent 6731019 commit 718b939

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/EFCore.PG/Query/Expressions/Internal/PgTableValuedFunctionExpression.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query.Expressions.Internal;
2121
/// doing so can result in application failures when updating to a new Entity Framework Core release.
2222
/// </para>
2323
/// </remarks>
24-
public class PgTableValuedFunctionExpression : TableValuedFunctionExpression, IEquatable<PgTableValuedFunctionExpression>
24+
public class PgTableValuedFunctionExpression : TableValuedFunctionExpression,
25+
IEquatable<PgTableValuedFunctionExpression>, IClonableTableExpressionBase
2526
{
2627
/// <summary>
2728
/// The name of the column to be projected out from the <c>unnest</c> call.
@@ -80,6 +81,12 @@ public override PgTableValuedFunctionExpression Update(IReadOnlyList<SqlExpressi
8081
? new PgTableValuedFunctionExpression(Alias, Name, arguments, ColumnInfos, WithOrdinality)
8182
: this;
8283

84+
// TODO: This is a hack for https://github.com/npgsql/efcore.pg/issues/3023; we notably don't visit the arguments, which we should
85+
// (but can't, since the Clone() API doesn't accept the cloning visitor).
86+
/// <inheritdoc />
87+
public TableExpressionBase Clone()
88+
=> new PgTableValuedFunctionExpression(Alias, Name, Arguments, ColumnInfos, WithOrdinality);
89+
8390
/// <inheritdoc />
8491
protected override void Print(ExpressionPrinter expressionPrinter)
8592
{

0 commit comments

Comments
 (0)