Re: SQL Editor hangs on COPY TO STDOUT

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: SQL Editor hangs on COPY TO STDOUT
Date: 2012-11-29 19:04:51
Message-ID: 1354215891.2188.1.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Fri, 2012-11-09 at 15:18 +0200, Heikki Linnakangas wrote:
> If you run something like:
>
> copy (select * from pg_stat_activity) to stdout;
>
> in the query editor, it will hang forever. The code in
> pgQueryThread::execute() doesn't check for a PGRES_COPY_OUT result,
> and
> calls PQgetResult() repeatedly. PQgetResult() will keep on returning
> PGRES_COPY_OUT until the copy output is read with PQgetCopyData(), so
> it
> gets stuck. COPY FROM STDOUT has a similar problem.
>
> Attached is a patch to fix that. For COPY TO STDOUT, it prints the
> first
> 100 rows to the message display. For COPY FROM STDIN, it throws an
> error.

I finally had some time to look at your patch. It's a great fix. I
applied it to 1.16 and master.

Thanks a lot.

--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2012-11-29 21:44:09 pgAdmin III commit: Save new comments on already existing columns when
Previous Message Guillaume Lelarge 2012-11-29 19:03:57 pgAdmin III commit: Fix the query editor behaviour with COPY