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

Re: feature request

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Tim Uckun <timuckun(at)gmail(dot)com>, "pgadmin-support(at)postgresql(dot)org" <pgadmin-support(at)postgresql(dot)org>
Subject: Re: feature request
Date: 2011-08-30 19:50:23
Message-ID: 1314733823.2379.5.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgadmin-support
On Tue, 2011-08-30 at 20:42 +0100, Dave Page wrote:
> On Tue, Aug 30, 2011 at 8:30 PM, Guillaume Lelarge
> <guillaume(at)lelarge(dot)info> wrote:
> > On Tue, 2011-08-30 at 19:29 +0100, Dave Page wrote:
> >> On Tue, Aug 30, 2011 at 6:15 PM, Guillaume Lelarge
> >> <guillaume(at)lelarge(dot)info> wrote:
> >> >>
> >> >> libpq doesn't support multiple resultsets in a single query unfortunately.
> >> >>
> >> >
> >> > As a matter of fact, it does (see
> >> > http://pgolub.wordpress.com/2009/11/17/script-slicing-by-pgmdd/), and I
> >> > really want pgAdmin to use this. Still need to find a good UI and some
> >> > time to work on it :)
> >>
> >> Err, no it doesn't. The blog you've referenced describes how PgMDD
> >> takes the PostgreSQL 8.3 parser and uses it to pre-parse scripts into
> >> individual statements on the client, which it then executes
> >> individually. That's similar to what's being asked for here, but has
> >> the rather nasty limitation of not understanding PG 8.4+'s grammar.
> >>
> >> Libpq itself only supports a single resultset for multi-part
> >> statements. Even in 9.1, the docs say:
> >>
> >> The command string can include multiple SQL commands (separated by
> >> semicolons). Multiple queries sent in a single PQexec call are
> >> processed in a single transaction, unless there are explicit
> >> BEGIN/COMMIT commands included in the query string to divide it into
> >> multiple transactions. Note however that the returned PGresult
> >> structure describes only the result of the last command executed from
> >> the string. Should one of the commands fail, processing of the string
> >> stops with it and the returned PGresult describes the error condition.
> >>
> >> (http://www.postgresql.org/docs/9.1/static/libpq-exec.html#LIBPQ-EXEC-MAIN)
> >>
> >> In other words, only the last resultset is accessible.
> >>
> >
> > You're right for PQexec. And wrong for PQsendQuery, which is the one we
> > use on the query tool.
> >
> > And to quote the fine manual :)
> > (http://www.postgresql.org/docs/9.1/static/libpq-async.html#LIBPQ-PQSENDQUERY):
> > After successfully calling PQsendQuery, call PQgetResult one or more
> > times to obtain the results. PQsendQuery cannot be called again (on the
> > same connection) until PQgetResult has returned a null pointer,
> > indicating that the command is done.
> 
> Oh, I stand corrected. That's pretty neat - I had read that before I
> think I mis-parsed it to mean that you call PQgetResult to get more
> results for the one and only resultset.
> 

Actually, I already tried to do it a few months before. But I didn't go
as far as working on the UI.


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


In response to

pgadmin-support by date

Next:From: Dave PageDate: 2011-08-30 19:52:09
Subject: Re: pgAdmin3 quits unexpectedly on Mac OS/X
Previous:From: Dave PageDate: 2011-08-30 19:42:18
Subject: Re: feature request

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