[Ur] SQL error using sqlite

Marc Weber marco-oweber at gmx.de
Thu Dec 16 11:50:47 EST 2010


I should have taken more care reading the message.

Excerpts from Adam Chlipala's message of Thu Dec 16 16:04:29 +0100 2010:
> BTW, this turns out not to have anything to do with SQLite.  I expect 
> the same error would show up with the other DBMSes.  All of them are 
> meant to be supported soundly by Ur/Web.

The concepts of sequnces (pg) and autoinc (mysql) are very different.
Eg in PG you can have OIDS (auto value which is not an incrementing
number). I don't know how to implement this in MySQL off my head.
(Using triggers would be a way - but does mysql_last_id() return it?)

That's why I'm not sure whether urweb can (and wants!) to support all
RDBMS in the same way.

In fact you must write special code. Eg MySQL allows "REPLACE INTO"
which es very convenient to use - but isn't (and won't be) supported by
PG for transactional reasons or such.

I'm pretty sure you can use MySQL to write something up which behaves
like sequences - but its not the "native" autoinc solution.
Unfortunately code is not that portable.

I didn't even try how well MySQL or sqlite works yet. I saw that urweb
supports sequences concluding incomplete MySQL support - which may have
been a false (but definitely healthy :) assumption.

> P.S.: It can be hard to tell whether a message is a "bug report," a 
> "question," or a "discussion starter."  This one seems like a bug report 
> to me, in which case it's more convenient for me if it's opened as an 
> issue in the Ur Mantis, rather than sent to the mailing list.  In 
> general, if you can get a parse error from GCC or a DBMS, then it's a 
> bug. :)  (Except in some cases where you use the FFI to do obscene things)
That's why we post first letting you judge. Discussing issues is more
convenient here.
 
I tested the following quotings for table names:

  MYSQL: use `foo-bar` or `foo bar`
  sqlite: use "foo bar"
  postgresql: use "foo bar"

Marc Weber



More information about the Ur mailing list