Is there any one else experiencing similar issues with writing using the "COPY" command?
Npgsql.PostgresException: 22021: invalid byte sequence for encoding "UTF8": 0x00
at Npgsql.NpgsqlConnector.DoReadMessage(DataRowLoadingMode dataRowLoadingMode, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadMessageWithPrepended(DataRowLoadingMode dataRowLoadingMode)
at Npgsql.NpgsqlConnector.ReadExpecting[T]()
at Npgsql.NpgsqlBinaryImporter.Close()
at RE.Importer.School.PostgresSQLAdapter.Dispose()
C# .NET Core
Npgsql version: 3.1.7
PostgreSQL version: 9.5.2
Operating system: macOS Sierra 10.12.3
Before diving into this, could you please try doing the same with the recently-released Npgsql 3.2.0? There were changes that should have removed some protocol sync bugs, just wanting to rule that out.
If not, PostgreSQL seems to be telling you that you sent a 0 character in one of your strings, which isn't allowed. I understand that you're cleansing your data but it's worth making sure. I'd narrow it down to the offensive string - removing rows and rows from the import until you're locked on the row which triggers the error, then the column. Once you have a specific string value triggering this (with the others working), you can see what's wrong