After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 662922 - GdaBinary data is written (or maybe read) to the database with escape characters
GdaBinary data is written (or maybe read) to the database with escape characters
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: Client library
4.99.x
Other Linux
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks: 662925
 
 
Reported: 2011-10-28 10:24 UTC by Murray Cumming
Modified: 2011-11-03 21:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test_libgda_binary.c (3.60 KB, text/plain)
2011-10-28 10:24 UTC, Murray Cumming
Details
test_libgda_unquoted_where_value.c (2.08 KB, text/plain)
2011-11-01 21:18 UTC, Murray Cumming
Details

Description Murray Cumming 2011-10-28 10:24:26 UTC
Created attachment 200162 [details]
test_libgda_binary.c

This test case shows that data written to the database is not the same as the data read back, at least with PostgreSQL. I think this started happening fairly recently. I noticed that I could no longer get correct image data to show in Glom.
Comment 1 Murray Cumming 2011-10-28 10:30:02 UTC
This test case has this output:

original 0: ch_read=92, ch_original=255
original 1: ch_read=51, ch_original=216
original 2: ch_read=55, ch_original=255
original 3: ch_read=55, ch_original=224
original 4: ch_read=92, ch_original=0
original 5: ch_read=51, ch_original=16
original 6: ch_read=51, ch_original=74

That 92 is the \ character, so I guess it is writing (or converting to, after reading) the escaped numeric syntax for each character of the original.
Comment 2 malerba 2011-10-30 16:23:25 UTC
I could not reproduce the problem with your test case. I've tried with glom's embedded PostgreSQL server and with another server; in all cases the blob read is the same as the written one. Could you be more specific on the versions of Libgda and the PostgreSQL server you are using for this test?
Comment 3 Murray Cumming 2011-10-30 19:55:09 UTC
(In reply to comment #2)
> I could not reproduce the problem with your test case. I've tried with glom's
> embedded PostgreSQL server and with another server;

Thanks for taking the time do that.

By the way, I now have a test for this in Glom's "make check", though it involves lots of Glom code in that case too.

> in all cases the blob read
> is the same as the written one. Could you be more specific on the versions of
> Libgda and the PostgreSQL server you are using for this test?

I'm using libgda from git master (5.0.0) and PostgreSQL 9.1. I can reproduce it on Ubuntu Oneiric and Fedora 16, which both have PostgreSQL 9.1 by default. Maybe I can test it using PostgreSQL 8.4 on Ubuntu - I will try.
Comment 4 Murray Cumming 2011-10-30 20:00:17 UTC
Actually, I guess that it is caused by a change of output format in PostgreSQL 9.0, mentioned here:
http://www.postgresql.org/docs/9.1/static/datatype-binary.html
Comment 5 malerba 2011-10-31 22:40:44 UTC
You were right, the problem was caused by the new HEX representation that comes as a default with PostgreSQL >= 9. Can you check the bug has been corrected as per commit http://git.gnome.org/browse/libgda/commit/?id=c05d146631356f937e04a29171df25fc4b5654c5 ?
Comment 6 Murray Cumming 2011-11-01 20:25:57 UTC
Thanks. The test case now passes.

However, I can't check yet that it fixes my problem in Glom, because as a side-effect, in Glom, I'm now seeing unquoted text values in where clauses, after setting them with gda_sql_builder_add_expr_value(), causing invalid SQL to be generated.

However, I have not yet managed to reproduce that in a simple C test case. I will keep trying.
Comment 7 Murray Cumming 2011-11-01 21:18:56 UTC
Created attachment 200453 [details]
test_libgda_unquoted_where_value.c

This simple test case shows the problem. It shows this warning:

** WARNING **: gda_connection_statement_execute_select() failed: column "something" does not exist
LINE 1: ...ngs"."name" FROM "songs" WHERE "songs"."name" = something
                                                              ^
Comment 8 malerba 2011-11-02 17:26:37 UTC
Ok, can you now check with commit http://git.gnome.org/browse/libgda/commit/?id=a8ebe53b8619ccdc8b649d5aaed2a656df87991c ?
Vivien
Comment 9 Murray Cumming 2011-11-02 23:22:55 UTC
Yes, it's all working again now. Many thanks.

Another tarball release would be nice so Glom can depend on this, if possible.

By the way, the SQLite provider seems to have a long-standing problem with GdaBinary values, but I will try to create a test case.
Comment 10 Murray Cumming 2011-11-03 21:39:03 UTC
(In reply to comment #9)
> By the way, the SQLite provider seems to have a long-standing problem with
> GdaBinary values, but I will try to create a test case.

Actually, I think the problem now is something that has started fairly recently. Filed in bug #663357 .