SQL Editor hangs on COPY TO STDOUT

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: SQL Editor hangs on COPY TO STDOUT
Date: 2012-11-09 13:18:09
Message-ID: 509D0291.9030004@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

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.

- Heikki

Attachment Content-Type Size
pgadmin-sql-editor-copy-output-1.patch text/x-diff 2.3 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Vladimir Kokovic 2012-11-10 14:51:33 Re: pg_scanner - patch no.1
Previous Message Dave Page 2012-11-09 09:29:23 Re: pg_scanner - patch no.1