sql - Alternative for reserved word "group" -
i take naming because appears user in many places default.
i create model named group, refers similar facebook groups.
because group common hoped possible use other common words (e.g. date), but... reserved word in sql , activerecord method (i.e. model.group(*args)
).
i cannot find valid (and generic need) synonym: how should behave in case? there convention or common replacement word "group"?
late party coworker sent me , had correct him.
the solution quoting identifiers. there no problem. in mysql quote backticks (`):
mariadb [some_db]> create view `group` (select 1 one); mariadb [some_db]> select * `group`; +-----+ | 1 | +-----+ | 1 | +-----+
in postgresql have use normal double quote (") instead: select * "group";
. in mssql,you use square brackets ([]): select * [group];
.
there many reserved words in sql , new may added. quote identifiers unless you're sure free.
active record should quote identifiers default. if forgets in case may bug.
Comments
Post a Comment