>>How do I cast VARCHAR to BYTEA?
>
>
> I think it would work to create a cast WITHOUT FUNCTION, assuming that
> the semantics you want is that the exact bytes in the varchar datum
> become the bytes in the bytea (no encoding or backslashing conversions).
Are pg_escape_bytea and pg_unescape_bytea available from the backend as
well as libpq?
Chris