When inserting data into a bytea column from a binary file (e.g. a PNG image - using the "Insert" form, that creates a file input for such column), I get the following error:
ERROR: invalid byte sequence for encoding "UTF8": 0x89
This is postgresql specific of course. It wouldn't be too hard to make this work around proper by making q() take an optional "is_binary" parameter. Each driver could handle binary quoting in it's own way.
Adminer is a great tool but, in my opinion, it handles binary data poorly. Binary data should be handled with prepared statements, not quoted like a string. The PHP docs on PDO::quote() say as much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I get this error too using latest code from github (2015-03-03).
Here's a work around:
In the process_input() function (in functions.inc.php) you'll see where it handles bytea and other binary types. Instead of
do
This is postgresql specific of course. It wouldn't be too hard to make this work around proper by making q() take an optional "is_binary" parameter. Each driver could handle binary quoting in it's own way.
Adminer is a great tool but, in my opinion, it handles binary data poorly. Binary data should be handled with prepared statements, not quoted like a string. The PHP docs on PDO::quote() say as much.