Strange \copy failure - Mailing list pgsql-bugs

From Steve Woodcock
Subject Strange \copy failure
Date
Msg-id m3g0d32ohs.fsf@soitsrv03.southam.sch
Whole thread Raw
Responses Re: Strange \copy failure  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
This is on postgresql 7.0.2, RH6.2.

I'm doing a \copy from psql of a 2035 line file, and the backend is
hanging (no CPU being used). Control-C doesn't cancel the command and
I have to Control-Z and 'kill %p' to get psql to terminate. The
interesting thing is that if I chop the input file in half, it
works. I can \copy the first half, and \copy the second half. Even
more interesting, if I take the first 2000 lines of the file it works,
and if I take the last 2000 lines of the file it works. This is a 2035
line file, so it makes me thing there isn't anything wrong with the
data in it.

For what it's worth, this file has been copied in daily for quite a
few months without problems.

Trying to \copy the whole file, the last few lines of postmaster
output are:

010614.14:00:38.425 [19753] query: COPY "allocation_header" FROM STDIN
010614.14:00:38.425 [19753] parser outputs:

{ QUERY :command 5  :utility ?  :resultRelation 0 :into <> :isPortal false :isBinary false :isTemp false :unionall
false:distinctClause <> :sortClause <> :rtable <> :targetlist <> :qual <> :groupClause <> :havingQual <> :hasAggs false
:hasSubLinksfalse :unionClause <> :intersectClause <> :limitOffset <> :limitCount <> :rowMark <>} 

010614.14:00:38.425 [19753] after rewriting:
{ QUERY
   :command 5
   :utility ?
   :resultRelation 0
   :into <>
   :isPortal false
   :isBinary false
   :isTemp false
   :unionall false
   :distinctClause <>
   :sortClause <>
   :rtable <>
   :targetlist <>
   :qual <>
   :groupClause <>
   :havingQual <>
   :hasAggs false
   :hasSubLinks false
   :unionClause <>
   :intersectClause <>
   :limitOffset <>
   :limitCount <>
   :rowMark <>
   }

010614.14:00:38.426 [19753] ProcessUtility: COPY "allocation_header" FROM STDIN
010614.14:00:38.427 [19753] NOTICE:  copy: line 1, CopyReadNewline: extra fields ignored
010614.14:00:38.428 [19753] NOTICE:  copy: line 2, CopyReadNewline: extra fields ignored
010614.14:00:38.428 [19753] NOTICE:  copy: line 3, CopyReadNewline: extra fields ignored
...
010614.14:00:38.598 [19753] NOTICE:  copy: line 837, CopyReadNewline: extra fields ignored
010614.14:00:38.598 [19753] NOTICE:  copy: line 838, CopyReadNewline: extra fields ignored
010614.14:00:38.599 [19753] NOTICE:  copy: line 839, CopyReadNewline: extra fields ignored
010614.14:00:38.599 [19753] NOTICE:  copy: line 840, CopyReadNewline: extra fields ignored

...and then it just sits there.

(the file has more columns in it than the database table, but this
shouldn't be a problem should it?)

If I do an SQL COPY rather than a \copy, it works fine.

I tried stopping and starting the postmaster, dropping and recreating
the database (with just empty tables, no data), and also creating a
new database (ie. different name), but nothing works. I'm a bit stuck
for ideas now!

In case it's useful here's the output from ipcs:

------ Shared Memory Segments --------
key       shmid     owner     perms     bytes     nattch    status
0x10feed01 0         root      644       25224     5
0x0052e2ca 8271873   postgres  700       144       1
0x0052e2c1 8271874   postgres  600       17227776  1
0x0052e2c7 8271875   postgres  600       66060     1
0x00280267 4         root      644       1048576   2

------ Semaphore Arrays --------
key       semid     owner     perms     nsems     status
0x00feed00 0         root      644       2
0x0052e2ce 54273     postgres  600       16
0x0052e2cf 54274     postgres  600       16
0x00280269 3         root      666       14

------ Message Queues --------
key       msqid     owner     perms     used-bytes  messages

When the postmaster is stopped, all the postgres owned lines go away,
so I don't think I've got any unattached ones lying around.

Does anybody have any ideas for what I can do to fix this?

Regards, Steve Woodcock

pgsql-bugs by date:

Previous
From: "Basil A. Evseenko"
Date:
Subject: Strange CREATE VIEW behavior??
Next
From: "Alexandr S."
Date:
Subject: Bug: the index on INTEGER field does not work (PG 7.1.2)