That name is probably a reserved word in the database engine you're using.
Every DBMS has a list of words that are off-limits for use as object
(table, field, index, function etc.) names. GROUP is a pretty common one
because of the GROUP BY operation. Take a look at gluon /
reserved_sql_keywords.py for a list per DBMS.
If you care about DBMS portability, a good practice is to instantiate your
DAL object with option check_reserved='all' -- this will prevent you from
using table / field / etc. names that conflict with your current DBMS or a
future one you may move to someday (one of the reasons I really like web2py
-- have moved between 4 DBMSs with no code changes!)
Regards --
On Saturday, December 1, 2012 5:01:17 PM UTC-5, David Tucker wrote:
>
> I'm editing my data model in db.py and trying to add a field to a table of
> accounts that groups them using a foreign key.
>
> Field('group', 'reference groups', ondelete='CASCADE',
> required=True, default=db(db.groups).select().first().id),
>
> causes a ticket that reads: and causes web2py to freeze
> (must force quit and reopen); however,
>
> Field('groupd', 'reference groups', ondelete='CASCADE',
> required=True, default=db(db.groups).select().first().id),
>
> works fine.
>
> Can someone explain why this is? Also, is there a better/more elegant way
> to specify a default for 'reference' types? Basically I want the default to
> be the first entry in the 'groups' table (which is a generic 'ungrouped'
> group).
>
> Thank you for any help, I'm a web2py noob coming from a PHP/MySQL
> background.
>
>
--