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
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 table.column (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
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 d...@articlass.org 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?
On Thu, 24 Feb 2011 16:43:56 +0530 Aveek Misra ave...@yahoo-inc.com wrote: Use a quote around the column name or explicitly specify the column as table.column (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 sim...@syounger.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?
On Thu, Feb 24, 2011 at 12:06 PM, Dave M G d...@articlass.org 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?
The best comparison I´ve never seen in my life was the TNT. LOL -- João Cândido de Souza Neto Johan De Meersman vegiv...@tuxera.be escreveu na mensagem news:AANLkTikPeVuTpj9E0iepFncCJZQOF6sn_dbrhp0=p...@mail.gmail.com... On Thu, Feb 24, 2011 at 12:06 PM, Dave M G d...@articlass.org 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
a crash bug
Hi: I find a crash bug, version is mysql 5.5.8 Just try: use test; drop table if exists t1,t2; create table t1(a int); create table t2(b int); PREPAREstmt FROM select sum(b) from t2 group by b having b in (select b from t1); execute stmt; -- crash zhongtao 2011-02-23
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 table.column (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?
LOL -- João Cândido de Souza Neto mos mo...@fastmail.fm 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 table.column (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
Get date from unix_timestamp only up to the hour
How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Get date from unix_timestamp only up to the hour
Bryan, Maybe something like this would work? select 1296158500 - (1296158500 % 3600) Hope that helps, Nathan On Thu, Feb 24, 2011 at 08:41:58AM -0800, Bryan Cantwell wrote: How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=nsulli...@cappex.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: Get date from unix_timestamp only up to the hour
If the timestmp is in seconds, the result is simply mod(timestamp,3600) - michael dykman On Thu, Feb 24, 2011 at 11:41 AM, Bryan Cantwell bcantw...@firescope.com wrote: How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=mdyk...@gmail.com -- - michael dykman - mdyk...@gmail.com May the Source be with you. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Get date from unix_timestamp only up to the hour
On 02/24/2011 05:41 PM, Bryan Cantwell wrote: How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? something like this: mysql set @now:=now(), @foo:=unix_timestamp(); select @now, @foo, @foo - minute(@now) * 60 - second(@now) as hour_unix, from_unixtime(@foo - minute(@now) * 60 - second(@now)); Query OK, 0 rows affected (0.00 sec) +-++++ | @now| @foo | hour_unix | from_unixtime(@foo - minute(@now) * 60 - second(@now)) | +-++++ | 2011-02-24 18:06:24 | 1298567184 | 1298566800 | 2011-02-24 18:00:00 | +-++++ 1 row in set (0.00 sec) t -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Re: Get date from unix_timestamp only up to the hour
Yes perfect! Thanks, I knew I was over thinking this. On 02/24/2011 10:56 AM, Nathan Sullivan wrote: Bryan, Maybe something like this would work? select 1296158500 - (1296158500 % 3600) Hope that helps, Nathan On Thu, Feb 24, 2011 at 08:41:58AM -0800, Bryan Cantwell wrote: How would I go about modifying a unix timestamp to actually represent the 'top of the hour' that it represents? For instance: 1296158500 = 1/27/2011 2:01:40 PM That is in the 2:00 pm hour, how can I find that out and modify it to 1296158400 which = 1/27/2011 2:00:00 PM? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=nsulli...@cappex.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: Get date from unix_timestamp only up to the hour
On 02/24/2011 05:56 PM, Nathan Sullivan wrote: Bryan, Maybe something like this would work? select 1296158500 - (1296158500 % 3600) ah, yes, even this one: mysql select now() - interval (unix_timestamp() % 3600) second; +---+ | now() - interval (unix_timestamp() % 3600) second | +---+ | 2011-02-24 18:00:00 | +---+ 1 row in set (0.00 sec) t -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Changing the timezone
Hi everyone, since I'm using the shared hosting, I can't change the default timezone for MySql. Question is: is there any query that I could launch in my connect.php before other queries to make my timezone change? For instance, I make a mysql_query(SET CHARACTER_SET_DATABASE='utf8') or die (Unable to change database charset: .mysql_error()); and a mysql_query(SET NAMES 'utf8') or die (Unable to set names: .mysql_error()); Maybe is there a way to change my timezone to Europe/Kiev? Thank you! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
RE: Changing the timezone
set time_zone='Europe/Kiev'; -Original Message- From: Andre Polykanine [mailto:an...@oire.org] Sent: Thursday, February 24, 2011 10:23 AM To: mysql@lists.mysql.com Subject: Changing the timezone Hi everyone, since I'm using the shared hosting, I can't change the default timezone for MySql. Question is: is there any query that I could launch in my connect.php before other queries to make my timezone change? For instance, I make a mysql_query(SET CHARACTER_SET_DATABASE='utf8') or die (Unable to change database charset: .mysql_error()); and a mysql_query(SET NAMES 'utf8') or die (Unable to set names: .mysql_error()); Maybe is there a way to change my timezone to Europe/Kiev? Thank you! -- With best regards from Ukraine, Andre Skype: Francophile Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=travis_...@hotmail.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
[X-POST] Free sample data (US Canada) for testing
Hey all - I've just uploaded some free Canada sample data to complement the US data that was already available. Testing apps with a representation amount of sample data is crucial to evaluate performance. Download the data here: http://www.briandunning.com/sample-data/ Enjoy, - Brian -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org
Problems Connecting with SSL
I have three mySQL server, all of which are SSL-enable and all of which are generally accessible from remote clients over SSL. However, one of my FreeBSD mySQL clients is having problems connecting to any of the servers. Running mySQL under truss reports the following: -- clock_gettime(13,{1298593067.0 })= 0 (0x0) open(/dev/urandom,O_RDONLY,00) = 4 (0x4) read(4,\a\^V\M-)\^C\M-L{`\M^O\M^@\M-v...,32) = 32 (0x20) sendto(2,\^V\^C\^A\0Y\^A\0\0U\^C\^A\M-m...,94,0x0,NULL,0x0) = 94 (0x5e) recvfrom(2,\^V,1,0x2,NULL,0x0) = 1 (0x1) ioctl(2,FIONREAD,0xd784) = 0 (0x0) recvfrom(2,\^V\^C\^A\0J\^B\0\0F\^C\^AMf\M-u...,1819,0x0,NULL,0x0) = 1819 (0x71b) clock_gettime(13,{1298593067.0 })= 0 (0x0) clock_gettime(13,{1298593067.0 })= 0 (0x0) gettimeofday({1298593067.844592 },0x0) = 0 (0x0) sendto(2,\^V\^C\^A\0F\^P\0\0B\0@\M-B\M^Y...,134,0x0,NULL,0x0) = 134 (0x86) recvfrom(2,\^U,1,0x2,NULL,0x0) = 1 (0x1) ioctl(2,FIONREAD,0xd784) = 0 (0x0) recvfrom(2,\^U\^C\^A\0\^B\^B\n\^V\0\0\^B...,33,0x0,NULL,0x0) = 33 (0x21) close(3) = 0 (0x0) shutdown(2,SHUT_RDWR)= 0 (0x0) close(2) = 0 (0x0) fstat(1,{ mode=crw--w ,inode=113,size=0,blksize=4096 }) = 0 (0x0) ioctl(1,TIOCGETA,0xe390) = 0 (0x0) write(2,ERROR 2026 (HY000): ,20) ERR#9 'Bad file descriptor' write(2,SSL connection error,20) ERR#9 'Bad file descriptor' write(2,\n,1) ERR#9 'Bad file descriptor' write(1,\a,1) = 1 (0x1) close(4) = 0 (0x0) process exit, rval = 1 -- Can anyone tell me, based on the truss output above, what might be going wrong? I'm using the exact same command line options and ssl-ca file that I am using on other clients, which can connect successfully. (As an aside: feature request: better SSL connection debugging, please!) Tim Gustafson Baskin School of Engineering UC Santa Cruz t...@soe.ucsc.edu 831-459-5354 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org