Re: how to select

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jonathan Villa <jvilla(at)innovativesource(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: how to select
Date: 2005-07-29 19:17:54
Message-ID: 20050729191754.GA98758@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 29, 2005 at 02:19:07PM -0500, Jonathan Villa wrote:
> I tried ending with a semicolon before, and received this error
>
> ERROR: parser: parse error at or near "select"
>
> I have to do it twice before I get it works...here's an example
>
> select project_name from project_group_list;
> ERROR: parser: parse error at or near "select"
> select project_name from project_group_list;

If you tried to run commands before the first SELECT but didn't end
them with a semicolon, then they were all being sent as a single
command, which usually results in a syntax error. Here's an example --
notice the slightly different prompt on the second line, which shows
that we're continuing a command started on a previous line:

test=> SELECT project_name FROM project_group_list
test-> SELECT project_name FROM project_group_list;
ERROR: syntax error at or near "SELECT" at character 45
LINE 2: SELECT project_name FROM project_group_list;
^
test=> SELECT project_name FROM project_group_list;
project_name
--------------
Project A
Project B
Project C
(3 rows)

In psql you can clear the query buffer with \r:

test=> SELECT project_name FROM project_group_list
test-> \r
Query buffer reset (cleared).
test=> SELECT project_name FROM project_group_list;
project_name
--------------
Project A
Project B
Project C
(3 rows)

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Villa 2005-07-29 19:19:07 Re: how to select
Previous Message Scott Marlowe 2005-07-29 19:17:36 Re: how to select