Re: [bug fix] psql \copy doesn't end if backend is killed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "MauMau" <maumau307(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [bug fix] psql \copy doesn't end if backend is killed
Date: 2014-02-14 00:55:31
Message-ID: 32508.1392339331@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"MauMau" <maumau307(at)gmail(dot)com> writes:
> If the backend is terminated with SIGKILL while psql is running "\copy
> table_name from file_name", the \copy didn't end forever. I expected \copy
> to be cancelled because the corresponding server process vanished.

I just noticed this CF entry pertaining to the same problem that Stephen
Frost reported a couple days ago:
http://www.postgresql.org/message-id/20140211205336.GU2921@tamriel.snowman.net

I believe it's been adequately fixed as of commits fa4440f516 and
b8f00a46bc, but if you'd test that those handle your problem cases,
I'd appreciate it.

> [Fix]
> If the message transmission fails in PQputCopyEnd(), switch
> conn->asyncStatus back to PGASYNC_BUSY.

This patch seems inappropriate to me, because it will allow libpq to exit
the COPY IN state whether or not it still has a live connection. If it
does, the backend will be in an inconsistent state and we'll have a mess.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2014-02-14 01:05:14 Re: narwhal and PGDLLIMPORT
Previous Message Fabrízio de Royes Mello 2014-02-14 00:44:56 Re: [PATCH] Store Extension Options