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 589607 - gda_connection_get_meta_store_data(GDA_CONNECTION_META_FIELDS) fails with uppercase table name
gda_connection_get_meta_store_data(GDA_CONNECTION_META_FIELDS) fails with upp...
Status: RESOLVED FIXED
Product: libgda
Classification: Other
Component: Client library
4.0.x
Other Linux
: Normal normal
: ---
Assigned To: malerba
gnome-db Maintainers
Depends on:
Blocks: 589102
 
 
Reported: 2009-07-24 13:38 UTC by Murray Cumming
Modified: 2009-07-27 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gda-metastore-capital-letters-fields.c (2.29 KB, text/x-csrc)
2009-07-24 13:39 UTC, Murray Cumming
Details
Modified test case with gda_meta_store_sql_identifier_quote() added (2.82 KB, text/x-csrc)
2009-07-24 19:15 UTC, malerba
Details

Description Murray Cumming 2009-07-24 13:38:20 UTC
The attachement shows that gda_connection_get_meta_store_data() fails with GDA_CONNECTION_META_FIELDS with a table name such as "CapitalTest", even when using the GDA_CONNECTION_OPTIONS_SQL_IDENTIFIERS_CASE_SENSITIVE connection option. 

The test creates a table, then updates and shows the metadata, then tries to get the fields list. It fails for both PostgreSQL and SQLite.
Comment 1 Murray Cumming 2009-07-24 13:39:50 UTC
Created attachment 139153 [details]
gda-metastore-capital-letters-fields.c

Fails for "CapitalTest". Succeeds for "lowercasetest".
Comment 2 malerba 2009-07-24 19:15:51 UTC
Created attachment 139174 [details]
Modified test case with gda_meta_store_sql_identifier_quote() added

You need to pass an SQL identifier which conforms to the "GdaMetaStore convention", which means using gda_meta_store_sql_identifier_quote(), or gda_sql_identifier_quote() directly. See my modified version of the attachment.

There was also some bug in the meta data retreival with SQLite, which I've corrected and pushed in master and LIBGDA_4.0.
Comment 3 Murray Cumming 2009-07-24 20:05:39 UTC
Thanks. I thought that the connection option made that unnecessary too. This is only for the meta store API, right?

What's the reasoning for requiring these input parameters to be modified like this? Why can't libgda just take the normal name string and do what it likes with it?
Comment 4 malerba 2009-07-25 08:09:59 UTC
Making sure the SQL identifiers as input to any meta store API respects the GdaMetaStore convention is a necessity because the SQL identifier used can come from either the user which created an object like in the test case, or from the GdaMetaStore itself where it already is in the correct convention representation.
Comment 5 Murray Cumming 2009-07-27 10:30:56 UTC
This indeed seems to be fixed now. Thanks.

Now I hit bug #589822 instead.
Comment 6 Murray Cumming 2009-07-27 10:41:53 UTC
How(In reply to comment #4)
> Making sure the SQL identifiers as input to any meta store API respects the
> GdaMetaStore convention is a necessity because the SQL identifier used can come
> from either the user which created an object like in the test case, or from the
> GdaMetaStore itself where it already is in the correct convention
> representation.

However, this leaks an internal data structure (the GdaMetaStore name convention) to the public API. I guess you need:
- a public API (that just takes names) and 
- an internal API (that takes names already in the internal format, without the need for any conversion) for performance.

Comment 7 malerba 2009-07-27 12:23:52 UTC
> However, this leaks an internal data structure (the GdaMetaStore name
> convention) to the public API.

When one obtains data from a meta store, it is obtained using that convention and one may use that input (which is in the GdaMetaStore name convention), so the public API really can be used with SQL identifiers which are already in the meta store convention.

Comment 8 Murray Cumming 2009-07-27 13:01:08 UTC
(In reply to comment #7)
> > However, this leaks an internal data structure (the GdaMetaStore name
> > convention) to the public API.
> 
> When one obtains data from a meta store, it is obtained using that convention

Yes, I don't like that either. It again leaks the internal representation.

I hope that the meta-store API can be corrected in a future libgda version.