pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Paul A Jungwirth <pj@illuminatedcomputing.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Jeff Davis <pgsql@j-davis.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: Re: range_agg
Date: Sat, 07 Mar 2020 16:06:32 -0500
Message-ID: <15764.1583615192@sss.pgh.pa.us> (raw)
In-Reply-To: <13800.1583612399@sss.pgh.pa.us>
References: <20200304022849.GA5402@alvherre.pgsql>
	<13800.1583612399@sss.pgh.pa.us>

I wrote:
> However, what I'm on about right at the moment is that I don't think
> there should be any delta in that test at all.  As far as I can see,
> the design idea here is that multiranges will be automatically created
> over range types, and the user doesn't need to do that.  To my mind,
> that means that they're an implementation detail and should not show up as
> separately-owned objects, any more than an autogenerated array type does.

Actually ... have you given any thought to just deciding that ranges and
multiranges are the same type?  That is, any range can now potentially
contain multiple segments?  That would eliminate a whole lot of the
tedious infrastructure hacking involved in this patch, and let you focus
on the actually-useful functionality.

It's possible that this is a bad idea.  It bears a lot of similarity,
I guess, to the way that Postgres doesn't consider arrays of different
dimensionality to be distinct types.  That has some advantages but it
surely also has downsides.  I think on the whole the advantages win,
and I feel like that might also be the case here.

The gating requirement for this would be to make sure that a plain
range and a multirange can be told apart by contents.  The first idea that
comes to mind is to repurpose the allegedly-unused RANGE_xB_NULL bits in
the flag byte at the end of the datum.  If one of them is set, then it's a
multirange, and we use a different interpretation of the bytes between the
type OID and the flag byte.

Assuming that that's ok, it seems like we could consider the traditional
range functions like lower() and upper() to report on the first or last
range bound in a multirange --- essentially, they ignore any "holes"
that exist inside the range.  And the new functions for multiranges
act much like array slicing, in that they give you back pieces of a range
that aren't actually of a distinct type.

			regards, tom lane





view thread (152+ messages)  latest in thread

Message-ID: <15764.1583615192@sss.pgh.pa.us>
Permalink:  ../15764.1583615192@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15764.1583615192@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pj@illuminatedcomputing.com, alvherre@2ndquadrant.com, pavel.stehule@gmail.com, pgsql@j-davis.com
  Subject: Re: range_agg
  In-Reply-To: <15764.1583615192@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