Re: I can't have "group" as a column name in a table? [SOLVED]
Aveek, Simcha, Johan, Thanks for explaining the situation. I knew there were some reserved words, but I hadn't realized there were so many. Anyway, now that I know I can protect my column names with backticks, I'm good to go. -- Dave M G -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
LOL -- João Cândido de Souza Neto "mos" escreveu na mensagem news:6.0.0.22.2.20110224093057.044a0...@mail.messagingengine.com... > At 05:13 AM 2/24/2011, you wrote: >>Use a quote around the column name or explicitly specify the column as >>. (as for e.g. mytable.group) in the query. For more >>details refer to >>http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html >> >>Thanks >>Aveek > > Hmmm. Everyone has given me a great idea. I am going to change my table > names to "Table", "Group", "Having", "Select", "Into", "Order By", > "Update", "Delete" etc. just to confuse hackers so they won't be able to > launch a sql injection attack against my website. The naming convention > will drive them crazy. > > Mike > (Just kidding) > > > >>On Feb 24, 2011, at 4:36 PM, Dave M G wrote: >> >> > MySQL users, >> > >> > Simple question: >> > >> > In one table in my database, the column was named "group". >> > >> > I kept getting failed query errors until I renamed the column. >> > >> > I've never before encountered a situation where MySQL mistook a column >> > name for part of the query syntax. >> > >> > Should I never use the word "group" for column names? Seems a little >> > silly. Is there a way to protect column names to that there is no >> confusion? >> > >> > -- >> > Dave M G >> > >> > -- >> > MySQL General Mailing List >> > For list archives: http://lists.mysql.com/mysql >> > To unsubscribe: >> > http://lists.mysql.com/mysql?unsub=ave...@yahoo-inc.com >> > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
At 05:13 AM 2/24/2011, you wrote: Use a quote around the column name or explicitly specify the column as . (as for e.g. mytable.group) in the query. For more details refer to http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Thanks Aveek Hmmm. Everyone has given me a great idea. I am going to change my table names to "Table", "Group", "Having", "Select", "Into", "Order By", "Update", "Delete" etc. just to confuse hackers so they won't be able to launch a sql injection attack against my website. The naming convention will drive them crazy. Mike (Just kidding) On Feb 24, 2011, at 4:36 PM, Dave M G wrote: > MySQL users, > > Simple question: > > In one table in my database, the column was named "group". > > I kept getting failed query errors until I renamed the column. > > I've never before encountered a situation where MySQL mistook a column > name for part of the query syntax. > > Should I never use the word "group" for column names? Seems a little > silly. Is there a way to protect column names to that there is no confusion? > > -- > Dave M G > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/mysql?unsub=ave...@yahoo-inc.com > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
The best comparison I´ve never seen in my life was the TNT. LOL -- João Cândido de Souza Neto "Johan De Meersman" escreveu na mensagem news:AANLkTikPeVuTpj9E0iepFncCJZQOF6sn_dbrhp0=p...@mail.gmail.com... > On Thu, Feb 24, 2011 at 12:06 PM, Dave M G wrote: > >> Should I never use the word "group" for column names? Seems a little >> silly. Is there a way to protect column names to that there is no >> confusion? >> > > As several people already pointed out, simply use backticks. Simple quotes > have started to work in more and more places in newer versions of MySQL. > > However, it is considered bad form to name columns for reserved words - > even > ones as obvious as "group" or "index". Bad form in the same way that you > wouldn't name any variables "define" or "if" while programming; or in a > very > similar way that you wouldn't put a box of TNT next to a burning candle - > it's an accident waiting to happen. > > The escapes are there in case an upgrade creates new reserved words that > you've already used in column names - "partition" comes to mind - but if > you > are still in a phase where you can avoid using reserved words, please > spare > yourself and others a lot of trouble and do so; even if only because while > you can fix your code, you can't fix someone else's - think management > tools, backup scripts, whatever may touch the db in the future. > > > -- > Bier met grenadyn > Is als mosterd by den wyn > Sy die't drinkt, is eene kwezel > Hy die't drinkt, is ras een ezel > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
On Thu, Feb 24, 2011 at 12:06 PM, Dave M G wrote: > Should I never use the word "group" for column names? Seems a little > silly. Is there a way to protect column names to that there is no > confusion? > As several people already pointed out, simply use backticks. Simple quotes have started to work in more and more places in newer versions of MySQL. However, it is considered bad form to name columns for reserved words - even ones as obvious as "group" or "index". Bad form in the same way that you wouldn't name any variables "define" or "if" while programming; or in a very similar way that you wouldn't put a box of TNT next to a burning candle - it's an accident waiting to happen. The escapes are there in case an upgrade creates new reserved words that you've already used in column names - "partition" comes to mind - but if you are still in a phase where you can avoid using reserved words, please spare yourself and others a lot of trouble and do so; even if only because while you can fix your code, you can't fix someone else's - think management tools, backup scripts, whatever may touch the db in the future. -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel
Re: I can't have "group" as a column name in a table?
On Thu, 24 Feb 2011 16:43:56 +0530 Aveek Misra wrote: > Use a quote around the column name or explicitly specify the column as > . (as for e.g. mytable.group) in the query. For more details > refer to http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html > use backticks, not quotes. `group`, not 'group'. -- Simcha Younger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
Have you read about reserved words in MySql? http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html -- João Cândido de Souza Neto "Dave M G" escreveu na mensagem news:4d663ba0.5090...@articlass.org... > MySQL users, > > Simple question: > > In one table in my database, the column was named "group". > > I kept getting failed query errors until I renamed the column. > > I've never before encountered a situation where MySQL mistook a column > name for part of the query syntax. > > Should I never use the word "group" for column names? Seems a little > silly. Is there a way to protect column names to that there is no > confusion? > > -- > Dave M G -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: I can't have "group" as a column name in a table?
Use a quote around the column name or explicitly specify the column as . (as for e.g. mytable.group) in the query. For more details refer to http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Thanks Aveek On Feb 24, 2011, at 4:36 PM, Dave M G wrote: > MySQL users, > > Simple question: > > In one table in my database, the column was named "group". > > I kept getting failed query errors until I renamed the column. > > I've never before encountered a situation where MySQL mistook a column > name for part of the query syntax. > > Should I never use the word "group" for column names? Seems a little > silly. Is there a way to protect column names to that there is no confusion? > > -- > Dave M G > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/mysql?unsub=ave...@yahoo-inc.com >
I can't have "group" as a column name in a table?
MySQL users, Simple question: In one table in my database, the column was named "group". I kept getting failed query errors until I renamed the column. I've never before encountered a situation where MySQL mistook a column name for part of the query syntax. Should I never use the word "group" for column names? Seems a little silly. Is there a way to protect column names to that there is no confusion? -- Dave M G -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org