That's fair. Thanks for looking into it. I can create JLEFT and JRIGHT or something, or just direct people to SUBSTR. There are reasonable workarounds.
Thanks, Eric -----Original Message----- From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Richard Hipp Sent: Monday, February 08, 2016 3:39 PM To: SQLite mailing list <sqlite-users at mailinglists.sqlite.org> Subject: Re: [sqlite] Can't create LEFT or RIGHT functions with sqlite3_create_function() On 2/8/16, Eric Hill <Eric.Hill at jmp.com> wrote: > Hey, > > It appears that LEFT and RIGHT are treated as reserved words by > SQLite, so my attempts to use sqlite3_create_function() to create my > own LEFT and RIGHT SQL functions have been unsuccessful (I'm using > 3.8.11.1). Several databases (SQL Server, MySQL) define their own > LEFT and RIGHT functions for performing sub-string functions, > apparently without conflicting with LEFT JOIN/RIGHT JOIN syntax. Is that > just not possible for SQLite? Not easily, it seems. There is a list of keywords that can fallback to be identifiers (https://www.sqlite.org/src/artifact/d7bff41d4?ln=220,233) if they cannot be parsed as their original keyword value. I tried adding JOIN_KW to that list. (JOIN_KW is a compound keyword that includes "LEFT", "RIGHT", "NATURAL", "CROSS", "FULL", "INNER", and "OUTER".) The result compiled, but lots of tests failed. I don't know if that is something that would be easy to fix or not. Even if it were possible to fix it, I am not in a big rush to do so. By allowing LEFT and RIGHT to be identifiers, we would be making a promise that they can be identifiers in all future versions of SQLite, which puts an additional constraint on future changes. I'm not sure this is worth it. -- D. Richard Hipp drh at sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users