Обсуждение: Inconsistent SQL errors

Поиск
Список
Период
Сортировка

Inconsistent SQL errors

От
gvim
Дата:
I'm running PostgreSQL 8.4.3 on OS X Snow Leopard via MacPorts and I'm getting strange inconsistent errors such as:

dbuser-# select * from log_form;
ERROR:  syntax error at or near "select"
LINE 2: select * from log_form;
         ^

Then later the same query will run fine, as it should.

gvim

Re: Inconsistent SQL errors

От
Scott Mead
Дата:

On Wed, Apr 14, 2010 at 11:04 PM, gvim <gvimrc@googlemail.com> wrote:
I'm running PostgreSQL 8.4.3 on OS X Snow Leopard via MacPorts and I'm getting strange inconsistent errors such as:

dbuser-# select * from log_form;
ERROR:  syntax error at or near "select"
LINE 2: select * from log_form;
       ^

Then later the same query will run fine, as it should.


Yup, it's because you previously entered something into psql without a ';'

  Normally, the psql prompt shows:

 dbuser=#


  You are showing:

 dbuser-#


 (Notice the '-' instead of '=' )

 This means that you entered a command and didn't put a semi-colon somewhere along the way.  If you see that, just enter a semi-colon and you'll get back to a top-level (=#) prompt.

--Scott 

gvim

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Inconsistent SQL errors

От
Boszormenyi Zoltan
Дата:
gvim írta:
> I'm running PostgreSQL 8.4.3 on OS X Snow Leopard via MacPorts and I'm
> getting strange inconsistent errors such as:
>
> dbuser-# select * from log_form;

The error is here above. You had a "-#" prompt, saying
that you already started another statement in a previous line
but you haven't finished it with a ";"

> ERROR:  syntax error at or near "select"
> LINE 2: select * from log_form;
>         ^

Also, the "LINE 2" message tells that you had something in
the first line which was not shown by you.

>
> Then later the same query will run fine, as it should.

I bet that you had a "=#" prompt when it ran fine, not "-#".

Best regards,
Zoltán Böszörményi


--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/