Re: default representation of null in psql

From: Chris Withers <chris(at)simplistix(dot)co(dot)uk>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: default representation of null in psql
Date: 2017-01-01 21:45:35
Message-ID: 27d0cefd-760a-6d62-f3d9-3af77e94fd02@simplistix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/12/2016 14:33, Adrian Klaver wrote:
> On 12/11/2016 11:34 PM, Chris Withers wrote:
>> On 01/12/2016 12:12, Francisco Olarte wrote:
>>> On Thu, Dec 1, 2016 at 12:56 PM, Chris Withers
>>> <chris(at)simplistix(dot)co(dot)uk> wrote:
>>>> So, first observation: if I make room nullable, the exclude
>>>> constraint does
>>>> not apply for rows that have a room of null. I guess that's to be
>>>> expected,
>>>> right?
>>>
>>> I would expect it, given:
>>>
>>> n=> select null=null, null<>null, not (null=null);
>>> ?column? | ?column? | ?column?
>>> ----------+----------+----------
>>> | |
>>> (1 row)
>>>
>>> Those are nulls,
>>
>> Yes, it's a shame psql has the same repr for null and empty-string ;-)
>
> test=# select NULL;
> ?column?
> ----------
>
> (1 row)
>
> test=# \pset null 'NULL'
> Null display is "NULL".
>
> test=# select NULL;
> ?column?
> ----------
> NULL
> (1 row)

Sure, so perhaps the default should change?

Of course, no-one has yet offered anything on the question I was really
hoping for help with:

>> Working with the exclude constraint example from
>> https://www.postgresql.org/docs/current/static/rangetypes.html:
>>
>> CREATE EXTENSION btree_gist;
>> CREATE TABLE room_reservation (
>> room text,
>> during tsrange,
>> EXCLUDE USING GIST (room WITH =, during WITH &&)
>> );
>>
>> Next question: if lots of rows have open-ended periods
>> (eg: [, 2010-01-01 15:00) or [2010-01-01 14:00,)), how does that affect
>> the performance of the btree gist index backing the exclude constraint?
>>
>> Tom Lane made a comment on here but never followed up with a definitive
>> answer. Can anyone else help?

cheers,

Chris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Frank Millman 2017-01-02 10:33:04 Difficulty modelling sales taxes
Previous Message Adrian Klaver 2016-12-31 16:54:39 Re: What's the benefit (or usage scenario) of a "typed table"?