Re: specifying multiple result format codes with libpq - Mailing list pgsql-hackers

From Tom Lane
Subject Re: specifying multiple result format codes with libpq
Date
Msg-id 22625.1087578679@sss.pgh.pa.us
Whole thread Raw
In response to specifying multiple result format codes with libpq  (Abhijit Menon-Sen <ams@wiw.org>)
Responses Re: specifying multiple result format codes with libpq
List pgsql-hackers
Abhijit Menon-Sen <ams@wiw.org> writes:
> The documentation for PQexecPrepared says:
>     (There is not currently a provision to obtain different result
>     columns in different formats, although that is possible in the
>     underlying protocol.)

> Would anyone be interested in a patch to allow this?

Yes, but not the way you suggest.  The ... approach forces calling code
to know *when it is written* how many result columns there will be,
because you'd have to actually write that number of parameters in the
call.  This is true in some simple cases but it's way too inflexible.

AFAICS this would need additional libpq functions with different
signatures, viz a count+array of result formats.  I desisted from doing
that in the 7.4 cycle because I thought the whole PQexec API probably
ought to be rethought in the light of the v3 protocol, and I didn't want
to provide a plethora of functions that would soon be deprecated.

No one's gotten around to thinking about a more general redesign of
libpq's query API yet, but I'd rather see us do that than put more
warts on the functions we have ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Casts question
Next
From: Carlos Guzmán Álvarez
Date:
Subject: Timestamp format question