Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » GROUP Problem

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 2181 Views
  • xeraa
    Google Summer of Code Hacker
    58 Posts

    GROUP Problem Link to this post

    After having some trouble (and posting a lengthy text which didn't really aid the question ;-) ) with GROUP (class / table), I wondered if it is very clever to have a table that is a reserved word (in MySQL, Postgres and MS SQL). For every query we use on that, we'll have to create a MySQL version (`Group`) and another version ("Group") - otherwise it will miserably fail .
    On the other hand it would require quite a lot of rewriting code to change it, so not sure it that would be a better alternative...

    To illustrate the problem, even simple queries will always require at least two versions, so instead of

    SELECT MAX(ID) FROM mytable

    This for MySQL

    SELECT MAX(ID) FROM `thetable`

    and for PostgreSQL and MS SQL

    SELECT MAX(ID) FROM "thetable"

  • Sigurd
    Forum Moderator
    628 Posts

    Re: GROUP Problem Link to this post

    Certainly tricky, as while you could change all the references inside SilverStripe easily, it might break people's personal code residing in their mysite folders.

    Presumeably you're putting ticks on table names anyway, so its not too hard to put \" on when not using mysql ... ?

  • xeraa
    Google Summer of Code Hacker
    58 Posts

    Re: GROUP Problem Link to this post

    Ok, I guess the issue is resolved

    You can use " on MySQL if you enable ANSI quotes via


    It needs to be set for every session - to set it permanently you would need full rights on the database which some people probably won't have, so this method should be working for everyone.

    I've also made that clear in the documentation and added all reserved words - so we'll be able to avoid them in the future ;-), see http://doc.silverstripe.com/doku.php?id=sql-queries

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.