ServiceStack/ServiceStack.OrmLite — pull request #191 by AkosLukacs (2013-03-05 21:59:42+00:00)
Title: Problem with PostgreSQL byte[] serialization/deserialization

In `PostgreSQLDialectProvider`, the insert command actually inserts a base64 encoded value instead of postgres-escaped valid "bytea" representation of the data.
For reading back the data `PostgreSQLDialectProvider.ConvertDbValue` falls back to `OrmLiteDialectProviderBase.ConvertDbValue` for `byte[]`, and that uses `TypeSerializer.DeserializeFromStream`. That is actually invalid, but it seems that it works with base64 encoded strings, as OrmLite's `Insert` does.

The `InsertParam` method does correctly insert values to the db, that causes any `Select` reading that value to fail.
First commit contains a couple of failing test in various combination of manual insert and select, `Insert`, `InsertParam`, `Select`.

Second commit changes serialization (copied from Npgsql2's code: https://github.com/franciscojunior/Npgsql2/blob/master/src/NpgsqlTypes/NpgsqlTypeConverters.cs ), and deserialization for `byte[]` (just returns it).

## Note:
This could be a breaking change for PostgreSQL users, if they used `Insert` and `Select` after inserting `byte[]`s in Postgres actually worked. But not really likely, since commit 584765e37e314c55d7cb57244c06d26c838d34f6 was publicly released in 3.9.38. two days ago).

@brainless83 - please take a look at this, if you use Postgres.