Reply to topic

Invalid query with STRFTIME

Registered Member

Invalid query with STRFTIME

Thu Aug 20, 2015 6:00 am
I'm trying to use the following query

SELECT STRFTIME('%W', '2015-01-01') as weeknum FROM mytable;

It works when I open the kexi project in sqlite3. When I try to enter it in the query editor I get the error "The query is incorrect". Error near "datatracker".

I thought Kexi uses sqlite under the hood. What's the issue? Is there any way to get access to strftime and other sqlite3-specific functions in queries?
User avatar jstaniek

Re: Invalid query with STRFTIME  Topic is solved

Wed Aug 26, 2015 6:49 am
Hi flightsixteen,
Kexi parses query statements in order to be able to apply best solution available.

Support status is collected for functions at: ... _Functions
Unfortunately strftime() isn't supported.
We recently addes substr() to 2.9.1. I see STRFTIME() is not that custom as we think, it's in PostgreSQL too.

The idea of adding support for special 'native', not-portable SQL is a very good one, would solve the general issue quickly. A wish from 2012:
Just linked to bountysource: ... in-queries

It's not a matter of a few lines of code though. Without parser we don't know what columns are there in the query, of what types and what constraints. Each database backend has own way to inform about this and SQLite lacked that completely when we started with it (it's one reason for having kexi__* metadata tables).

Best regards,
Jarosław Staniek

KEXI - Open Source Visual DB Apps Builder
• Request feature or fix for KEXI here
May I help you? Please mention your app's version and OS when asking for help

Reply to topic


Who is online

Registered users: arkascha, Baidu [Spider], Bing [Bot], gfielding, Google [Bot], ineuw, jbeeckaert, jmacleod, sandro4912, Sogou [Bot], YaCy [Bot]