I have a problem with a memo field. My [Delphi] DA custom server has a datMemo field on a table. The server can save to either DBISAM (field defined as Memo) or PostgreSQL (field defined as text).
It works perfectly well on the DBISAM DB, but it’s not working correctly on PostgreSQL when the length of the text is >163 characters and I can’t see why.
I actually add a lot of rows to the table at the client side, applyupdates and there are no errors raised from the server side (and even if I run it in the Delphi debugger no exceptions seem to happen), but no data is saved to the DB if a single row has one of these fields with long text. If I trim the field by copy(myFieldData,0,163) then it works just fine.
Any suggestions as to how to debug this appreciated.
Thanks
can you specify what driver you are using for PostgreSQL?
if you replace your PostgreSQL driver with something else, like Anydac/PgDAC/etc, this case will be reproduced?
I had trouble getting ADO working with PG but have discovered the actual error is not to do with the length, but presumably something in the text from the memo:
[FireDAC][Phys][PG][libpq] ERROR: invalid byte sequence for encoding "UTF8": 0x00"
If you need to store UTF8 data in your database, you need a database that accepts UTF8. You can check the encoding of your database in pgAdmin. Just right-click the database, and select “Properties”.
But that error seems to be telling you there’s some invalid UTF8 data in your source file.
Thanks, I do have it set for UTF8. I’m wondering now if it’s something it doesn’t like in the source. Maybe CRLF (#10#13 type) that is in the text. I’ll see if stripping them out will help, though I’d prefer them to stay.