diff --git a/src/Npgsql/PublicAPI.Unshipped.txt b/src/Npgsql/PublicAPI.Unshipped.txt
index e152ada722..50b8d6c3da 100644
--- a/src/Npgsql/PublicAPI.Unshipped.txt
+++ b/src/Npgsql/PublicAPI.Unshipped.txt
@@ -2,3 +2,4 @@
Npgsql.NpgsqlSlimDataSourceBuilder.EnableGeometricTypes() -> Npgsql.NpgsqlSlimDataSourceBuilder!
Npgsql.NpgsqlSlimDataSourceBuilder.EnableJsonTypes() -> Npgsql.NpgsqlSlimDataSourceBuilder!
Npgsql.NpgsqlSlimDataSourceBuilder.EnableNetworkTypes() -> Npgsql.NpgsqlSlimDataSourceBuilder!
+Npgsql.Replication.PgOutput.ReplicationValue.GetFieldName() -> string!
diff --git a/src/Npgsql/Replication/PgOutput/ReplicationValue.cs b/src/Npgsql/Replication/PgOutput/ReplicationValue.cs
index c5d1772745..5f7d76b418 100644
--- a/src/Npgsql/Replication/PgOutput/ReplicationValue.cs
+++ b/src/Npgsql/Replication/PgOutput/ReplicationValue.cs
@@ -76,6 +76,12 @@ public bool IsUnchangedToastedValue
/// The data type of the specified column.
public Type GetFieldType() => _fieldDescription.FieldType;
+ ///
+ /// Gets the name of the specified column.
+ ///
+ /// The name of the specified column.
+ public string GetFieldName() => _fieldDescription.Name;
+
///
/// Gets the value of the specified column as a type.
///
diff --git a/test/Npgsql.Tests/Replication/PgOutputReplicationTests.cs b/test/Npgsql.Tests/Replication/PgOutputReplicationTests.cs
index e3d81a63f5..a32528452a 100644
--- a/test/Npgsql.Tests/Replication/PgOutputReplicationTests.cs
+++ b/test/Npgsql.Tests/Replication/PgOutputReplicationTests.cs
@@ -125,12 +125,27 @@ public Task Insert()
Assert.That(insertMsg.Relation, Is.SameAs(relationMsg));
var columnEnumerator = insertMsg.NewRow.GetAsyncEnumerator();
Assert.That(await columnEnumerator.MoveNextAsync(), Is.True);
+ var postgresType = columnEnumerator.Current.GetPostgresType();
+ Assert.That(postgresType.FullName, Is.EqualTo("pg_catalog.integer"));
+ Assert.That(columnEnumerator.Current.GetDataTypeName(), Is.EqualTo("integer"));
+ Assert.That(columnEnumerator.Current.GetFieldName(), Is.EqualTo("id"));
if (IsBinary)
+ {
+ Assert.That(columnEnumerator.Current.GetFieldType(), Is.EqualTo(typeof(int)));
Assert.That(await columnEnumerator.Current.Get(), Is.EqualTo(1));
+ }
else
+ {
+ Assert.That(columnEnumerator.Current.GetFieldType(), Is.EqualTo(typeof(string)));
Assert.That(await columnEnumerator.Current.Get(), Is.EqualTo("1"));
+ }
Assert.That(await columnEnumerator.MoveNextAsync(), Is.True);
+ postgresType = columnEnumerator.Current.GetPostgresType();
+ Assert.That(postgresType.FullName, Is.EqualTo("pg_catalog.text"));
+ Assert.That(columnEnumerator.Current.GetDataTypeName(), Is.EqualTo("text"));
+ Assert.That(columnEnumerator.Current.GetFieldType(), Is.EqualTo(typeof(string)));
+ Assert.That(columnEnumerator.Current.GetFieldName(), Is.EqualTo("name"));
Assert.That(columnEnumerator.Current.IsDBNull, Is.False);
Assert.That(await columnEnumerator.Current.Get(), Is.EqualTo("val1"));
Assert.That(await columnEnumerator.MoveNextAsync(), Is.False);