psql -f inconsistency with "copy from stdin"

From: Brook Milligan <brook(at)biology(dot)nmsu(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql -f inconsistency with "copy from stdin"
Date: 2000-01-11 23:35:24
Message-ID: 200001112335.QAA00351@biology.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Today I ran into an inconsistency between two versions of postgresql
in how psql handles copies from stdin. At this point I am not sure
how the rewrite of psql does things, but thought I'd mention the
problem in case someone with it installed can check.

The issue is how the command

psql -f test.sql db < test.dat

is treated, given the following files:

-- test.sql
drop table test;
create table test (name text);
copy test from stdin;
select * from test;

and

test.dat
a
b

Specifically v6.4.2 and v6.5.2 differ in the outcome, with v6.4.2
producing what I would expect and v6.5.2 producing anomalous output.
Note that performing the copy as

psql -c "copy test from stdin" db < test.dat

works fine in either case.

v6.4.2 output: The contents of test.dat are read into the table as
one might expect having redirected that file to stdin and copying from
stdin.

v6.5.2 output: The contents of test.dat are not read into the table at
all. Instead, the remainder of the test.sql file (i.e., select * ...)
are read into the table.

How does the current version behave when performing these copies? If
it still behaves like 6.5.2, I suspect there is some bug in handling
the copy command.

Cheers,
Brook

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-01-12 00:01:17 Re: [HACKERS] CREATE TABLE ... PRIMARY KEY kills backend
Previous Message Oliver Elphick 2000-01-11 22:29:28 CREATE TABLE ... PRIMARY KEY kills backend