Re: how to select - Mailing list pgsql-general

From Michael Fuhr
Subject Re: how to select
Date
Msg-id 20050729191754.GA98758@winnie.fuhr.org
Whole thread Raw
In response to Re: how to select  ("Jonathan Villa" <jvilla@innovativesource.net>)
List 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/

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: how to select
Next
From: Jaime Casanova
Date:
Subject: Re: how to select