public void PqsqlCopyToTest10() { const int len = 2; PqsqlTransaction tran = mConnection.BeginTransaction(); mCmd.Transaction = tran; mCmd.CommandText = "create temporary table foo (a bytea); " + "insert into foo values (null); " + "insert into foo values ('\\x707173716C'); "; mCmd.CommandType = CommandType.Text; int affected = mCmd.ExecuteNonQuery(); Assert.AreEqual(len, affected); var copy = new PqsqlCopyTo(mConnection) { Table = "foo", ColumnList = "a", CopyTimeout = 10, }; copy.Start(); var res = copy.FetchRow(); Assert.IsTrue(res); var a0 = copy.ReadRaw(); Assert.IsNull(a0); res = copy.FetchRow(); Assert.IsTrue(res); var a1 = copy.ReadRaw(); CollectionAssert.AreEqual(new byte[] { 0x70, 0x71, 0x73, 0x71, 0x6C }, a1); res = copy.FetchRow(); Assert.IsFalse(res); copy.Close(); tran.Rollback(); }