Anyone have experience with PostgreSQL storing binary data? The ODBC driver has a setting... "bytea as LO".. I checked it, but it converts all the "non-printable" characters wrong. With it unchecked (default option) it stores no data at all.

I am using a binary field, set the size to about 2mb in dataflex, "bytea" data type in PostgreSQL. Is the ODBC driver not working correctly with binary data?

Code:
            Integer iCh
            UChar[] uaUCArrayForPDF

            //save bitmap file to ztest table
            Get Seq_New_Channel to iCh
            Direct_Input channel iCh ("binary: " + "C:\zDF\test_input.bmp")
            If (SeqEof) Begin
                Procedure_Return
            End
            Read_Block channel iCh uaUCArrayForPDF -1
            Close_Input channel iCh

            Clear ztest
            Move "0000019" to ztest.wo_no
            Find eq ztest by Index.1
            If (Found) Begin
                Set_Field_Value ztest.File_Number (RefTable(ztest.pdf)) to uaUCArrayForPDF
                SaveRecord ztest
            End
            Send Seq_Release_Channel iCh

            //read bitmap and save to file
            Get Seq_New_Channel to iCh
            Clear ztest
            Move "0000019" to ztest.wo_no
            Find eq ztest by Index.1
            If (Found) Begin
                Get_Field_Value ztest.File_Number (RefTable(ztest.pdf)) to uaUCArrayForPDF
            End

            Direct_Output channel iCh ("binary: " + "C:\zDF\test_output.bmp")
            Write channel iCh uaUCArrayForPDF
            Close_Output channel iCh
            Send Seq_Release_Channel iCh