[Ur] camel case for database table names

Adam Chlipala adamc at csail.mit.edu
Thu Jan 22 11:28:54 EST 2015


On 01/18/2015 03:48 AM, Kevin Johnson wrote:
> Hi Adam,
>
> It turns out that by default, MySQL on windows is case insensitive for 
> table names, and case sensitive when installed in linux.  To make the 
> MySQL server case insensitive in linux, edit the my.cnf file and place 
> lower_case_table_names = 1 after the [mysqld].  Then restart mysql.  
> You must first rename all the tables to use lower case--so this is 
> best done before you put anything in the database.
>
> I think using all lower case table names would be recommended, so that 
> the code is portable from windows to linux.

Yeah, it doesn't sound nice to ask everyone to tweak their MySQL config 
to make Ur/Web work.  You may have been able to infer that I don't use 
Ur/Web with MySQL by choice personally, so it's easy to miss some change 
like this one in the latest MySQL that breaks things!  (It definitely 
worked a few years back.)

> But even so, if you do a "strings urblog.exe" you will find that the 
> table is referenced by both mixed case and lower case.  It seems like 
> it just checks the existence of the lower case named tables, as any 
> data I put in them was ignored.  It used the data from the table with 
> the mixed case name.  I hope that gives you a hint on where to look.  
> I should also note that the urblog.sql file contained the mixed case 
> table names.

I've changed the compiler to, I hope, use all-lowercase names everywhere 
for MySQL.  That change is pushed to the public Mercurial repo for 
Ur/Web.  Please let me know if it doesn't work you now, too.  (Thanks 
for the clear explanation of the problem!)

> Kevin Johnson
>
>
> On Sat, Jan 17, 2015 at 6:39 PM, Adam Chlipala <adamc at csail.mit.edu 
> <mailto:adamc at csail.mit.edu>> wrote:
>
>     Probably the underlying problem here is that MySQL is relatively
>     underused and thus untested with Ur/Web!  If you compile with
>     'urweb -debug', you will see all of the SQL strings that are being
>     used, some in /tmp/webapp.c.  Can you tell me the right case to
>     use everywhere?  (I /think/ case is at least being used
>     consistently throughout the generated code, so apparently MySQL
>     applies a case preference automatically somewhere.  Also, I'm
>     pretty sure the main demo has worked with MySQL recently, so maybe
>     some element of your configuration is nonstandard, e.g. the
>     filesystem?)
>
>
>     On 01/17/2015 02:23 PM, Kevin Johnson wrote:
>>     When I try to execute the examples from Gian Perrone's web
>>     tutorial, I get the following error:
>>
>>     Fatal initialization error: Table 'uw_urblog_comment' does not exist.
>>
>>     I am running mysql 5.5 on a ubuntu system.
>>
>>     The urblog.sql defined the table as 'uw_Urblog_comment'.
>>
>>     I have tried modifying the sql file to use 'uw_urblog_comment',
>>     but then the urblog.exe complains that 'uw_Urblog_comment'
>>     doesn't exist.
>>
>>     I have to have both table names in the database.  Is there
>>     perhaps an ignore table name case flag I am missing somewhere
>>     that everyone uses?
>>
>>     Thank you,
>>
>>     Kevin Johnson
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150122/f14c0725/attachment.html>


More information about the Ur mailing list