Further to the earlier replies, here is a funny SQLite demo of function,
keyword, and column names that is informative about the possibilities.

sqlite> .load distinct.so
sqlite> SELECT DISTINCT "distinct"() "distinct" WHERE [distinct] NOT NULL;
distinct
"fn distinct was called"

----distinct.c extension function source----
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
static void distinct(sqlite3_context *context, int argc, sqlite3_value
**argv) {
  sqlite3_result_text(context, "fn distinct was called", 22,
SQLITE_TRANSIENT);
}
int sqlite3_distinct_init(sqlite3 *db, char **pzErrMsg, const
sqlite3_api_routines *pApi) {
  SQLITE_EXTENSION_INIT2(pApi);
  int rc = sqlite3_create_function(db, "distinct", -1, SQLITE_UTF8, 0,
distinct, 0, 0);
  return rc;
}


On Tue, Feb 20, 2018 at 2:59 PM, Etienne Sanchez <etiennesanch...@gmail.com>
wrote:

> Hi,
>
> Some other DBMS such as Postgres and SQL-Server implement the functions
> "left" and "right". SQLite does not. But why do I get confusing error
> messages when I (mistakenly) attempt to use them?
>
> To illustrate my point:
>
>
> select foo('abc', 2)
> Error: no such function: foo
>
> select left('abc', 2)
> Error: near "(": syntax error
>
> select right('abc', 2)
> Error: near "(": syntax error
>
>
> In the 2nd and 3rd cases I would expect a "no such function" error. The
> "syntax error" messages are slightly misleading, they lead the user to
> think that he has forgotten a parenthesis or a comma somewhere in the
> query.
>
> As for "left", it's maybe due to the ambiguity with "left join", but then
> what about "right"? (There is no ambiguity with "right join" since it is
> not supported.)
>
> Thanks,
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to