passing shell variable to the SET data type in parentheses
Hi guys, i have a problem when trying to pass shell variable to the SET data type in parentheses. i have a variable like this: $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. Greetings, Marco -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: passing shell variable to the SET data type in parentheses
What is the result if you echo that line instead of running it? ie: echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( '$var' );' $database ; I'm not clear exactly what the text is of the command you are trying to run. - michael dykman On Wed, Oct 3, 2012 at 9:35 AM, Morning Star morning.star.c...@gmail.com wrote: Hi guys, i have a problem when trying to pass shell variable to the SET data type in parentheses. i have a variable like this: $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. Greetings, Marco -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- - 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
Re: passing shell variable to the SET data type in parentheses
are you trying to get the value of var encapsulated with ' ' marks? Typical shell expansion while within will output the literal: var=10 echo '$var' '10' Have you tried removing the single quotes? The shell can be funny with ' and garotconk...@yahoo.com From: Michael Dykman mdyk...@gmail.com To: Morning Star morning.star.c...@gmail.com Cc: mysql@lists.mysql.com Sent: Wednesday, October 3, 2012 3:41 PM Subject: Re: passing shell variable to the SET data type in parentheses What is the result if you echo that line instead of running it? ie: echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( '$var' );' $database ; I'm not clear exactly what the text is of the command you are trying to run. - michael dykman On Wed, Oct 3, 2012 at 9:35 AM, Morning Star morning.star.c...@gmail.com wrote: Hi guys, i have a problem when trying to pass shell variable to the SET data type in parentheses. i have a variable like this: $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. Greetings, Marco -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql -- - 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
Re: passing shell variable to the SET data type in parentheses
Should have included an example: echo $var value1,value2,value3 echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( '$var' );' $database ; mysql -u -p --skip-column-names -e ALTER TABLE MODIFY SET( value1,value2,value3 ); echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( $var );' $database ; mysql -u -p --skip-column-names -e ALTER TABLE MODIFY SET( $var ); echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( '$var' );' $database ; mysql -u -p --skip-column-names -e ALTER TABLE MODIFY SET( value1,value2,value3 ); I believe that this is what Michael was eluding to as well... garotconk...@yahoo.com From: Garot Conklin garotconk...@yahoo.com To: Michael Dykman mdyk...@gmail.com; Morning Star morning.star.c...@gmail.com Cc: mysql@lists.mysql.com mysql@lists.mysql.com Sent: Wednesday, October 3, 2012 3:50 PM Subject: Re: passing shell variable to the SET data type in parentheses are you trying to get the value of var encapsulated with ' ' marks? Typical shell expansion while within will output the literal: var=10 echo '$var' '10' Have you tried removing the single quotes? The shell can be funny with ' and garotconk...@yahoo.com From: Michael Dykman mdyk...@gmail.com To: Morning Star morning.star.c...@gmail.com Cc: mysql@lists.mysql.com Sent: Wednesday, October 3, 2012 3:41 PM Subject: Re: passing shell variable to the SET data type in parentheses What is the result if you echo that line instead of running it? ie: echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE ' $table' MODIFY '$kolom' SET( '$var' );' $database ; I'm not clear exactly what the text is of the command you are trying to run. - michael dykman On Wed, Oct 3, 2012 at 9:35 AM, Morning Star morning.star.c...@gmail.com wrote: Hi guys, i have a problem when trying to pass shell variable to the SET data type in parentheses. i have a variable like this: $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. Greetings, Marco -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql -- - 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
need list of country ISO code to demonyms
Anyone have a SQL dump or other programmatically useable map of country ISO codes to demonyms? http://www.geography-site.co.uk/pages/countries/demonyms.html I can parse the strings I suppose there, but that's not quite as accurate, and ripping that out of the HTML page to parse seems painful too.
Re: need list of country ISO code to demonyms
I don't have it, sorry. But it took me 10 seconds to copy paste it to an Excel, so I could save it as CSV and import it directly to MySQL. Further on, it'd be as simples as JOIN by name with a table with ISO-to-country-names, which you can fetch in hundreds of places, such as Wikipedia. -NT Em 03-10-2012 22:22, Daevid Vincent escreveu: Anyone have a SQL dump or other programmatically useable map of country ISO codes to demonyms? http://www.geography-site.co.uk/pages/countries/demonyms.html I can parse the strings I suppose there, but that's not quite as accurate, and ripping that out of the HTML page to parse seems painful too. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
RE: need list of country ISO code to demonyms
HA! No $hit! Well isn't that clever. I didn't know that you can highlight a table like that, and paste it into Excel. That darn Microsoft -- they think of everything! :) Thanks for the tip. -Original Message- From: Nuno Tavares [mailto:nuno.tava...@dri.pt] Sent: Wednesday, October 03, 2012 3:10 PM To: mysql@lists.mysql.com Subject: Re: need list of country ISO code to demonyms I don't have it, sorry. But it took me 10 seconds to copy paste it to an Excel, so I could save it as CSV and import it directly to MySQL. Further on, it'd be as simples as JOIN by name with a table with ISO-to-country-names, which you can fetch in hundreds of places, such as Wikipedia. -NT Em 03-10-2012 22:22, Daevid Vincent escreveu: Anyone have a SQL dump or other programmatically useable map of country ISO codes to demonyms? http://www.geography-site.co.uk/pages/countries/demonyms.html I can parse the strings I suppose there, but that's not quite as accurate, and ripping that out of the HTML page to parse seems painful too. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
RE: need list of country ISO code to demonyms
Quoting Daevid Vincent dae...@daevid.com: HA! No $hit! Well isn't that clever. I didn't know that you can highlight a table like that, and paste it into Excel. That darn Microsoft -- they think of everything! :) Hell, don't give them ideas! They'll be trying to patent cut and paste... Dave Thanks for the tip. -Original Message- From: Nuno Tavares [mailto:nuno.tava...@dri.pt] Sent: Wednesday, October 03, 2012 3:10 PM To: mysql@lists.mysql.com Subject: Re: need list of country ISO code to demonyms I don't have it, sorry. But it took me 10 seconds to copy paste it to an Excel, so I could save it as CSV and import it directly to MySQL. Further on, it'd be as simples as JOIN by name with a table with ISO-to-country-names, which you can fetch in hundreds of places, such as Wikipedia. -NT Em 03-10-2012 22:22, Daevid Vincent escreveu: Anyone have a SQL dump or other programmatically useable map of country ISO codes to demonyms? http://www.geography-site.co.uk/pages/countries/demonyms.html I can parse the strings I suppose there, but that's not quite as accurate, and ripping that out of the HTML page to parse seems painful too. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- If all the advertising in the world were to shut down tomorrow, would people still go on buying more soap, eating more apples, giving their children more vitamins, roughage, milk, olive oil, scooters and laxatives, learning more languages by iPod, hearing more virtuosos by radio, re-decorating their houses, refreshing themselves with more non-alcoholic thirst-quenchers, cooking more new, appetizing dishes, affording themselves that little extra touch which means so much? Or would the whole desperate whirligig slow down, and the exhausted public relapse upon plain grub and elbow-grease? --- Dorothy L Sayers, in Murder Must Advertise -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: need list of country ISO code to demonyms
Ermmm... actually it was done from Firefox to OpenOffice Calc, on Ubuntu.. :-) I just mentioned Excel so you could get the idea... glad I could help, though :-) -NT Em 03-10-2012 23:21, Daevid Vincent escreveu: HA! No $hit! Well isn't that clever. I didn't know that you can highlight a table like that, and paste it into Excel. That darn Microsoft -- they think of everything! :) Thanks for the tip. -Original Message- From: Nuno Tavares [mailto:nuno.tava...@dri.pt] Sent: Wednesday, October 03, 2012 3:10 PM To: mysql@lists.mysql.com Subject: Re: need list of country ISO code to demonyms I don't have it, sorry. But it took me 10 seconds to copy paste it to an Excel, so I could save it as CSV and import it directly to MySQL. Further on, it'd be as simples as JOIN by name with a table with ISO-to-country-names, which you can fetch in hundreds of places, such as Wikipedia. -NT Em 03-10-2012 22:22, Daevid Vincent escreveu: Anyone have a SQL dump or other programmatically useable map of country ISO codes to demonyms? http://www.geography-site.co.uk/pages/countries/demonyms.html I can parse the strings I suppose there, but that's not quite as accurate, and ripping that out of the HTML page to parse seems painful too. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Accessing Column Aliases In Other Columns?
I would like to refer to calculated columns in other columns. I thought a column alias would do it, but apparently they're only for aggregation, like GROUP BY. Other than repeating the entire calculation, what techniques are available for accessing such a calculation? I'm calculating an electric bill, based on meter readings. I need to subtract two meter readings, and use that number in several other calculations, for example. Transformation is not what happens once we've changed; it's coming out of the dark and seeing what we've got and relating to it appropriately and clearly. If we've got a funnel in our hands but we think it's a bucket, we're going to keep losing things we value. If we know we've got a funnel, then we stick one finger in the hole and use it like a bucket to get by in the absence of one. We're transformed when we fully know who we are — or, even more important, who we are not. -- Rick Lewis Jan Steinman, EcoReality Co-op -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
RE: Accessing Column Aliases In Other Columns?
One way: SELECT @foo := this + that, more_stuff + @foo FROM ...; Another way: SELECT foo, more_stuff + foo FROM ( SELECT this + that AS foo FROM ... ) x; -Original Message- From: Jan Steinman [mailto:j...@bytesmiths.com] Sent: Wednesday, October 03, 2012 4:09 PM To: mysql@lists.mysql.com Subject: Accessing Column Aliases In Other Columns? I would like to refer to calculated columns in other columns. I thought a column alias would do it, but apparently they're only for aggregation, like GROUP BY. Other than repeating the entire calculation, what techniques are available for accessing such a calculation? I'm calculating an electric bill, based on meter readings. I need to subtract two meter readings, and use that number in several other calculations, for example. Transformation is not what happens once we've changed; it's coming out of the dark and seeing what we've got and relating to it appropriately and clearly. If we've got a funnel in our hands but we think it's a bucket, we're going to keep losing things we value. If we know we've got a funnel, then we stick one finger in the hole and use it like a bucket to get by in the absence of one. We're transformed when we fully know who we are - or, even more important, who we are not. -- Rick Lewis Jan Steinman, EcoReality Co-op -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: passing shell variable to the SET data type in parentheses
2012/10/03 20:35 +0700, Morning Star $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. If your var really has three pairs of double-quotes, with the double-quotes within the single-quotes, you get that this ... SET( value1,value2,value3 ); is passed to MySQL client, which is not valid. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
Re: passing shell variable to the SET data type in parentheses
Thanks guys for all the corrections. I fix it by executing: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; :) Greetings, Marco On Thu, Oct 4, 2012 at 4:49 AM, h...@tbbs.net wrote: 2012/10/03 20:35 +0700, Morning Star $ echo $var value1,value2,value3 what i did: mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE '$table' MODIFY '$kolom' SET( '$var' );' $database ; the result: ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'value1,value2,value3' at line 1 what do i have to do? please help me. If your var really has three pairs of double-quotes, with the double-quotes within the single-quotes, you get that this ... SET( value1,value2,value3 ); is passed to MySQL client, which is not valid. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql
InnoDB corrupt after power failure
Hi guys, I recently had a data corruption issue with InnoDB. MySQL was shut down improperly (power failure), and when the system came back up, MySQL refused to start. On inspection of the logs (see below), it looks like the tablespace became seriously corrupted. In the end, I had to rebuild the slave using mysqldump. I'm curious what happened here, since I thought InnoDB wasn't supposed to become corrupted on an improper shutdown. One possibility that we were exploring was that the filesystem journal setting was incorrect. We were using ext3 with the journal set to writeback mode. Is this a known bad config with InnoDB? Thanks for any help, Andrew --- MySQL server version: Server version: 5.5.27-1~ppa1~lucid-log (Ubuntu) (Running on Ubuntu 10.04.2 LTS) 120831 20:56:01 InnoDB: The InnoDB memory heap is disabled 120831 20:56:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120831 20:56:01 InnoDB: Compressed tables use zlib 1.2.3.3 120831 20:56:02 InnoDB: Initializing buffer pool, size = 5.0G 120831 20:56:03 InnoDB: Completed initialization of buffer pool 120831 20:56:06 InnoDB: highest supported file format is Barracuda. InnoDB: Log scan progressed past the checkpoint lsn 62096393185 120831 20:56:06 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 230. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 373. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 214. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 222. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 2673. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 2681. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 46. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Warning: database page corruption or a failed InnoDB: file read of space 0 page 62. InnoDB: Trying to recover it from the doublewrite buffer. InnoDB: Recovered the page from the doublewrite buffer. InnoDB: Doing recovery: scanned up to log sequence number 62096881152 InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 198. InnoDB: You may have to recover from a backup. 120831 20:56:33 InnoDB: Page dump in ascii and hex (16384 bytes): len 16384; hex {Big dump here -- I can supply if needed} InnoDB: End of page dump 120831 20:56:33 InnoDB: Page checksum 3859504003, prior-to-4.0.14-form checksum 1080681687 InnoDB: stored checksum 3859504003, prior-to-4.0.14-form stored checksum 3870577874 InnoDB: Page lsn 14 1966349405, low 4 bytes of lsn at page end 1966973261 InnoDB: Page number (if stored to page already) 198, InnoDB: space id (if created with = MySQL-4.1.1 and stored already) 0 InnoDB: Page may be a system page InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 198. InnoDB: You may have to recover from a backup. InnoDB: It is also possible that your operating InnoDB: system has corrupted its own file cache InnoDB: and rebooting your computer removes the InnoDB: error. InnoDB: If the corrupt page is an index page InnoDB: you can also try to fix the corruption InnoDB: by dumping, dropping, and reimporting InnoDB: the corrupt table. You can use CHECK InnoDB: TABLE to scan your table for corruption. InnoDB: See also http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. InnoDB: Ending processing because of a corrupt database page. 120831 20:56:33 InnoDB: Assertion failure in thread 140548948399904 in file buf0buf.c line 3609 InnoDB: We intentionally generate a memory trap. InnoDB: Submit a detailed bug report to http://bugs.mysql.com. InnoDB: If you get repeated assertion failures or crashes, even InnoDB: immediately after the mysqld startup, there may be InnoDB: corruption in the InnoDB tablespace. Please refer to