Forums | Mahara Community
Support
/
A table called 'group'
17 June 2009, 15:41
OK, I dont know how you did this but it would appear someone was able to create a table in the database called "group" which is a reserved keyword according to:
http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
mysql> SHOW TABLES LIKE '%group%'
-> ;
+------------------------------+
| Tables_in_mahara (%group%) |
+------------------------------+
| group |
| group_member |
| group_member_invite |
| group_member_request |
| grouptype |
| grouptype_config |
| grouptype_cron |
| grouptype_event_subscription |
| grouptype_installed |
| grouptype_roles |
| view_access_group |
| view_autocreate_grouptype |
+------------------------------+
12 rows in set (0.00 sec)
mysql>
How do I describe this table? I am trying to troubleshoot an issue with groups! By the way creating tables using reserved keywords is a really really bad idea.
17 June 2009, 19:51
Firstly, no it's not. It's the database's fault for not understanding the context when you do things like DESCRIBE group;. Postgres handles this fine.
You can do queries against it by quoting it using SQL standard quoting: double quotes. E.g.:
SELECT * FROM "group";
In Mahara, we turn on the SQL standard quoting so we can use double quotes for identifiers. But if you connect to a mysql shell, that mode probably isn't turned on by default, so you will probably have to use the MySQL specific quotes:
SELECT * FROM `group`;
18 June 2009, 10:22
Hi Nigel,
I learned something from your post, thanks, though the double quotes wont work I think the backticks will, Its been a while since I worked with postgres, I do remember that DBMS, didnt want to start a flame war between the two.
I will give the backticks a shot.
Thanks!