CLI can"t read data from table

CLI can"t read data from table

am 15.04.2010 01:31:04 von Mike Diehl

Hi all.

Now this one is strange.

I just created a new table called "lines." I can use Open Office to read the
records in it just fine.

However, when I type this command at the cli, I get an error:


select * from lines;
ERROR 1064 (42000): 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 'lines' at line 1

I can't use the describe command, either.

However, show tables lists the table.

This is a replicated database, so whatever I need to do to repair this, needs
to work across replication.

Any ideas?

--

Take care and have fun,
Mike Diehl.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: CLI can"t read data from table

am 15.04.2010 01:49:43 von Jesper Wisborg Krogh

--Boundary-01=_XSlxLXoOXYSuwKr
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

On Thu, 15 Apr 2010 09:31:04 Mike Diehl wrote:
> I just created a new table called "lines." I can use Open Office to read
> the records in it just fine.
>
> However, when I type this command at the cli, I get an error:
>
>
> select * from lines;
> ERROR 1064 (42000): 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 'lines' at line 1

Lines is a reserved keyword (e.g. like in "LINES TERMINATED BY"), so it must be quoted:

test> use test;
Database changed
test> CREATE TABLE `lines` (id int unsigned NOT NULL PRIMARY KEY) ENGINE=InnoDB;
Query OK, 0 rows affected (0.20 sec)

test> SELECT * FROM lines;
ERROR 1064 (42000): 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 'lines' at line 1
test> SELECT * FROM `lines`;
Empty set (0.01 sec)

Best regards,
Jesper
--Boundary-01=_XSlxLXoOXYSuwKr--

Re: CLI can"t read data from table

am 15.04.2010 02:05:45 von Mike Diehl

On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote:

> Lines is a reserved keyword (e.g. like in "LINES TERMINATED BY"), so it
> must be quoted:
>
> test> use test;
> Database changed
> test> CREATE TABLE `lines` (id int unsigned NOT NULL PRIMARY KEY)
> ENGINE=InnoDB; Query OK, 0 rows affected (0.20 sec)

Yup, that was it. I'm migrating from Postgres, so it never occured to me
that "lines" might be reserved.

Thanks.


--

Take care and have fun,
Mike Diehl.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: CLI can"t read data from table

am 15.04.2010 03:39:03 von Dan Nelson

In the last episode (Apr 14), Mike Diehl said:
> On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote:
> > Lines is a reserved keyword (e.g. like in "LINES TERMINATED BY"), so it
> > must be quoted:
> >
> > test> use test;
> > Database changed
> > test> CREATE TABLE `lines` (id int unsigned NOT NULL PRIMARY KEY)
> > ENGINE=InnoDB; Query OK, 0 rows affected (0.20 sec)
>
> Yup, that was it. I'm migrating from Postgres, so it never occured to me
> that "lines" might be reserved.

On the plus side, you can now use the word "vacuum" :)

--
Dan Nelson
dnelson@allantgroup.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: CLI can"t read data from table

am 15.04.2010 19:20:52 von Mike Diehl

On Wednesday 14 April 2010 7:39:03 pm Dan Nelson wrote:
> In the last episode (Apr 14), Mike Diehl said:
> > On Wednesday 14 April 2010 5:49:43 pm Jesper Wisborg Krogh wrote:
> > > Lines is a reserved keyword (e.g. like in "LINES TERMINATED BY"), so it
> > > must be quoted:
> > >
> > > test> use test;
> > > Database changed
> > > test> CREATE TABLE `lines` (id int unsigned NOT NULL PRIMARY KEY)
> > > ENGINE=InnoDB; Query OK, 0 rows affected (0.20 sec)
> >
> > Yup, that was it. I'm migrating from Postgres, so it never occured to me
> > that "lines" might be reserved.
>
> On the plus side, you can now use the word "vacuum" :)

I needed a good chuckle. Thank you!

--

Take care and have fun,
Mike Diehl.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org