agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: James Cloos <cloos@jhcloos.com>
To: pgsql-sql@postgresql.org
Subject: using possibly null timestamptz columns
Date: Thu, 29 Sep 2016 08:35:30 -0400
Message-ID: <m3a8eqx4rx.fsf@carbon.jhcloos.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Given a table with a pair of timestamptz columns (lets call them s and e)
which are typically null, is there a better way to write this where clause
snippet:

    where ( s is null or s <= now() ) and ( e is null or e >= now() )

In particular I hope to ensure efficient indexes.

-JimC
-- 
James Cloos <cloos@jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (4+ messages)  latest in thread

Message-ID: <m3a8eqx4rx.fsf@carbon.jhcloos.org>
Permalink:  ../m3a8eqx4rx.fsf@carbon.jhcloos.org/
Also on:    postgresql.org/message-id/m3a8eqx4rx.fsf@carbon.jhcloos.org

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-sql@postgresql.org
  Cc: cloos@jhcloos.com
  Subject: Re: using possibly null timestamptz columns
  In-Reply-To: <m3a8eqx4rx.fsf@carbon.jhcloos.org>

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

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