Skip site navigation (1) Skip section navigation (2)

Re: bug fix request

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: bug fix request
Date: 2004-11-29 07:33:14
Message-ID: 41AAD0BA.2080508@familyhealth.com.au (view raw or flat)
Thread:
Lists: pgsql-hackers
>>Presently you get a million lines of '\N command not recognised' and 
>>various other random things because if a line of the copy fails due to 
>>say a FK constraint, or even if the COPY is run in an aborted 
>>transaction, it tries to execute all the stdin data as actual 
>>statements.
> 
> I'd like to see a test case for this in v3 protocol.  It was definitely
> a problem before that, but I thought I fixed it.

This is with 7.4 and it still does it....  Here is an example:

Make file called test.sql:

BEGIN;
CREATE TABLE blah (a int4);
COPY blah FROM STDIN;
1
2
3
\.
COMMIT;

Now, execute it TWICE on a clean database:

-bash-2.05b$ psql -f test.sql test
BEGIN
CREATE TABLE
COMMIT
-bash-2.05b$ psql -f test.sql test
BEGIN
psql:test.sql:2: ERROR:  relation "blah" already exists
psql:test.sql:3: ERROR:  current transaction is aborted, commands 
ignored until end of transaction block
psql:test.sql:7: invalid command \.
psql:test.sql:8: ERROR:  syntax error at or near "1" at character 1
-bash-2.05b$

>>Also, sometimes when you copy and paste SQL into a psql window, it 
>>executes help on commands for each line, although it doesn't affect the 
>>paste.  That is also really annoying.
> 
> Disable tab completion, or don't paste tabs.  I don't think psql can be
> expected to recognize that a tab is coming from pasted input.

How about if it's in a literal, eg. function definition.

Chris

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2004-11-29 07:34:26
Subject: Re: multiline CSV fields
Previous:From: Tom LaneDate: 2004-11-29 07:21:44
Subject: Re: bug fix request

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group