Bug 250514 - Akonadi SQL table names are not correct
Summary: Akonadi SQL table names are not correct
Status: RESOLVED INTENTIONAL
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR minor
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-08 03:00 UTC by Kévin FERRARE
Modified: 2010-09-13 11:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kévin FERRARE 2010-09-08 03:00:38 UTC
Version:           unspecified (using KDE 4.5.0) 
OS:                Linux

Akonadi uses tables names with case, for example MimeTypeTable
According to the SQL standard, you have to enclose your identifiers in double quotes if you want them to be treated in a case-sensitive manner.

http://developer.mimer.com/documentation/html_92/Mimer_SQL_Mobile_DocSet/Syntax_Rules3.html

Akonadi does not seem to do that, so for example in my postgresql database I get table names in low cases like mimetypetable instead of the intended MimeTypeTable

Reproducible: Always
Comment 1 Kévin FERRARE 2010-09-08 03:01:36 UTC
This report does not concern kaddressbook, but akonadi
Comment 2 Tobias Koenig 2010-09-10 16:11:41 UTC
Hej Kevin,

can you paste the error message that you get, please?
We are not aware of any problems using camelcase table names in mysql and postgresql so far...

Ciao,
Tobias
Comment 3 Kévin FERRARE 2010-09-11 07:40:46 UTC
Sorry if my explanations were unclear.

There are no errors, but looking at the database initialization log, the tables and fields names seems to be intended to be in CameCase.

Now if I look at the resulting tables / fields names in postgresql, they are all in lowercase.

I suppose that this is not the intended result.
Comment 4 Tobias Koenig 2010-09-13 06:56:42 UTC
Hej Kevin,

identifiers and keywords are case insensitive in PostgreSQL, therefor what you see is completely fine. Akonadi always uses case sensitive names, how the database handles them is out of our scope.

Ciao,
Tobias
Comment 5 Kévin FERRARE 2010-09-13 07:39:27 UTC
What I want is that if akonadi wants to use camelcase identifiers, it should write them inside double quotes as the SQL standard specifies.

Identifiers are always case insensitive in SQL if not inside double quotes, this should also happen on other databases engines, and makes the database difficult to read.
Comment 6 Tobias Koenig 2010-09-13 10:42:41 UTC
Hej Kevin,

sorry but for me it looks like you want to solve a problem that just doesn't exists.
I have _never_ used quotes for table names with MySQL, PostgreSQL or SQLite and it always worked, so I see no point in changing the code if there is no problem, since this change might introduce new bugs... (not all SQL implementations are standard conform... ;))

Ciao,
Tobias
Comment 7 Kévin FERRARE 2010-09-13 11:08:52 UTC
Yes, Mysql seems to be case sensitive by default which is not a standard behaviour.
You say that you never used quotes in postgres, if so, please try the following :
CREATE TABLE "Aa"();
CREATE TABLE "aa"();
That's perfectly valid because "Aa" and "aa" are different

CREATE TABLE Aa();
CREATE TABLE aa();
will throw an error because without quotes, Aa becomes aa so they are the same table.

In akonadi for example, you attempt to create CollectionAttributeTable, but collectionattributetable is created instead.

While it works, this is not correct in my opinion, and it makes the database harder to read.