Re: Request for comment on setting binary format output per session

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Dave Cramer <davecramer(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Request for comment on setting binary format output per session
Date: 2023-03-22 18:05:03
Message-ID: 4297b9e310172b9a1e6d737e21ad8796d0ab7b03.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2023-03-22 at 10:12 +0100, Peter Eisentraut wrote:
> Sending type names is kind of useless if what comes back with the
> result
> (RowDescription) are OIDs anyway.
>
> The client would presumably have some code like
>
> if (typeoid == 555)
>      parseThatType();
>
> So it already needs to know about the OIDs of all the types it is
> interested in.

Technically it's still an improvement because you can avoid an extra
round-trip. The client library can pipeline a query like:

SELECT typname, oid FROM pg_type
WHERE typname IN (...list of supported type names...);

when the client first connects, and then go ahead and send whatever
queries you want without waiting for the response. When you get back
the result of the pg_type query, you cache the mapping, and use it to
process any other results you get.

That avoids introducing an extra round-trip. I'm not sure if that's a
reasonable thing to expect the client to do, so I agree that we should
offer a better way.

Regards,
Jeff Davis

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-03-22 18:05:31 Re: ICU locale validation / canonicalization
Previous Message Zheng Li 2023-03-22 18:04:15 Re: Initial Schema Sync for Logical Replication