pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Olivier Leprêtre <o.lepretre@gmail.com>
To: 'pgsql-admin' <pgsql-admin@postgresql.org>
Subject: filter partitions
Date: Tue, 13 Feb 2018 16:07:58 +0100
Message-ID: <5a82ff51.8f0c1c0a.ffaa0.df34@mx.google.com> (raw)

Hi,

 

I wonder how could it be possible to extract partitions that contains a
peculiar item 

 

Consider 4 partitions 1, 2, 3, 4 with different items A, B, C... inside

 

P item

1 A

1 B

1 C

2 B

2 D

2 G

2 H

3 B

3 C

4 X

4 D

4 Z

 

 

How could a select return partitions 2,4 because they both contains D item ?

 

As a result, I would get :

 

2 B

2 D

2 G

2 H

4 X

4 D

4 Z

 

I can filter partitions with lag, lead, nth_value... but how could I write
something like "select P,any (item=D) over (partition by P) from..."

 

Thanks for any help,

 

 



---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus

view thread (5+ messages)  latest in thread

Message-ID: <5a82ff51.8f0c1c0a.ffaa0.df34@mx.google.com>
Permalink:  ../5a82ff51.8f0c1c0a.ffaa0.df34@mx.google.com/
Also on:    postgresql.org/message-id/5a82ff51.8f0c1c0a.ffaa0.df34@mx.google.com

 · 

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-admin@postgresql.org
  Cc: o.lepretre@gmail.com
  Subject: Re: filter partitions
  In-Reply-To: <5a82ff51.8f0c1c0a.ffaa0.df34@mx.google.com>

* 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