> I would think this should echo *two* "INSERT <oid> 1" messages, instead
> of just 1.
> 
> % createdb viewsdb 
> CREATE DATABASE
> % psql -d viewsdb -c "create table foo(i integer); create table bar(j
> integer);"
> CREATE
> % psql -d viewsdb -c "insert into foo(i) values (1); insert into foo(i)
> values (2);"
> INSERT 9968065 1
> % psql -d viewsdb -c "select * from foo;"
>  i 
> ---
>  1
>  2
> (2 rows)
> 
> % psql -d viewsdb -c "select oid from foo;"
>    oid   
> ---------
>  9968064
>  9968065
> (2 rows)
> 

The query is sent as one string, and only one return is sent back.  It
has always been that way.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Thu, 8 Jun 2000 12:42:05 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re:  interactive oddity for psql -c "cmd; cmd;"
I would think this should echo *two* "INSERT <oid> 1" messages, instead
of just 1.

% createdb viewsdb 
CREATE DATABASE
% psql -d viewsdb -c "create table foo(i integer); create table bar(j
integer);"
CREATE
% psql -d viewsdb -c "insert into foo(i) values (1); insert into foo(i)
values (2);"
INSERT 9968065 1
% psql -d viewsdb -c "select * from foo;"
 i 
---
 1
 2
(2 rows)

% psql -d viewsdb -c "select oid from foo;"
   oid   
---------
 9968064
 9968065
(2 rows)

Thu, 08 Jun 2000 11:42:28 -0500
Ed Loehr <eloehr@austin.rr.com>
interactive oddity for psql -c "cmd; cmd;"
Bruce Momjian writes:

> > % psql -d viewsdb -c "insert into foo(i) values (1); insert into foo(i)
> > values (2);"
> > INSERT 9968065 1

> The query is sent as one string, and only one return is sent back.  It
> has always been that way.

Which can be construed as a semi-feature because that's the only way to
get unencumbered strings from psql to the backend.

-- 
Peter Eisentraut                  Sernanders vï¿½g 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden


Thu, 8 Jun 2000 19:09:16 +0200 (CEST)
Peter Eisentraut <peter_e@gmx.net>
Re:  interactive oddity for psql -c "cmd; cmd;"
Bruce Momjian wrote:
> 
> > I would think this should echo *two* "INSERT <oid> 1" messages, instead
> > of just 1.
> >
> > % psql -d viewsdb -c "insert into foo(i) values (1); insert into foo(i)
> > values (2);"
> > INSERT 9968065 1
> 
> The query is sent as one string, and only one return is sent back.  It
> has always been that way.

That's unintuitive and inconsistent behavior, albeit largely
inconsequential, when compared with the same line in a script...

% psql -d vtdb 
vtdb=# INSERT INTO foo(i) values (13); INSERT INTO foo(i) values (13);
INSERT 9971328 1
INSERT 9971329 1

Regards,
Ed Loehr

Thu, 08 Jun 2000 12:25:09 -0500
Ed Loehr <eloehr@austin.rr.com>
Re:  interactive oddity for psql -c "cmd; cmd;"