pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Mitar <mmitar@gmail.com>
Cc: f.venchiarutti@ocado.com
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Automatically parsing in-line composite types
Date: Thu, 31 Oct 2019 10:59:50 -0400
Message-ID: <19215.1572533990@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHyXU0ycMsjW-s=+Tn2BUW1qaZ5NuDt3Z9BPRzopbyaRCx+DPQ@mail.gmail.com>
References: <CAKLmikMrm778-eETLvVAd1W_u0R8TB+suAFO6jhMTmXQg3yhGg@mail.gmail.com>
	<CAKLmikPK_XeWT978gpozHsMFQ+JURqJsUmDGpC2gLt1sOdvmcw@mail.gmail.com>
	<CADK3HHKbTx2yLwikjcjaZ_Qfm1-ZWh=U=uH-pc14vDp-j7NUzw@mail.gmail.com>
	<e72efb14-4015-5820-850b-8b8ae14de7bd@ocado.com>
	<CAKLmikP4b8H9tCVOptxUAfgDZ=jEOaGe59r861gjaX80tY1asw@mail.gmail.com>
	<31567.1572373980@sss.pgh.pa.us>
	<20191030224105.dwej53kaklipfz5w@alap3.anarazel.de>
	<CAHyXU0ycMsjW-s=+Tn2BUW1qaZ5NuDt3Z9BPRzopbyaRCx+DPQ@mail.gmail.com>

Merlin Moncure <mmoncure@gmail.com> writes:
> On Wed, Oct 30, 2019 at 5:41 PM Andres Freund <andres@anarazel.de> wrote:
>> Hm. Wouldn't it be fairly easy to allow the client to specify how much
>> metadata they'd want? I.e. opt-in into getting more complete metadata?

> Suppose you had a set of 1000 records, with an array of composites (10
> items per array).  How many times would the extra metadata describing
> get sent following this approach?

Presumably once per Describe request (or once per simple Query) ...
but that facile answer actually isn't very satisfactory.  It's
at least theoretically possible that a column of type "record" could
have varying actual rowtype from one tuple to the next.  I don't want
to swear that every part of Postgres is capable of coping with that,
but a lot is --- see record_out() itself for the prototypical coding
pattern.  The wire protocol is really pretty tightly bound to the
assumption that every tuple in a resultset has the same description,
but that's going to fall down if we want to transmit details about
what "record" means.

The same problem occurs with arrays, specifically anyarray --- and
here I don't have to think hard to come up with a query that will
break it.  "select * from pg_stats" is enough to do that.

It's not only the wire protocol that's going to have issues with
varying rowtypes.  How would we deal with that in libpq's resultset
API, for example?  I wonder whether the JDBC API could handle it either.

tl;dr: there are a lot more worms in this can than you might guess.

			regards, tom lane





view thread (17+ messages)  latest in thread

Message-ID: <19215.1572533990@sss.pgh.pa.us>
Permalink:  ../19215.1572533990@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19215.1572533990@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mmoncure@gmail.com, andres@anarazel.de, mmitar@gmail.com, f.venchiarutti@ocado.com, pg@fastcrypt.com
  Subject: Re: Automatically parsing in-line composite types
  In-Reply-To: <19215.1572533990@sss.pgh.pa.us>
  References: <CAKLmikMrm778-eETLvVAd1W_u0R8TB+suAFO6jhMTmXQg3yhGg@mail.gmail.com> <CAKLmikPK_XeWT978gpozHsMFQ+JURqJsUmDGpC2gLt1sOdvmcw@mail.gmail.com> <CADK3HHKbTx2yLwikjcjaZ_Qfm1-ZWh=U=uH-pc14vDp-j7NUzw@mail.gmail.com> <e72efb14-4015-5820-850b-8b8ae14de7bd@ocado.com> <CAKLmikP4b8H9tCVOptxUAfgDZ=jEOaGe59r861gjaX80tY1asw@mail.gmail.com> <31567.1572373980@sss.pgh.pa.us> <20191030224105.dwej53kaklipfz5w@alap3.anarazel.de> <CAHyXU0ycMsjW-s=+Tn2BUW1qaZ5NuDt3Z9BPRzopbyaRCx+DPQ@mail.gmail.com> <19215.1572533990@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox