Re: Make foo=null a warning by default.

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Make foo=null a warning by default.
Date: 2018-07-16 15:19:22
Message-ID: 0ddf50c5-25bb-e175-809d-0f453427861d@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16/07/18 18:10, Tom Lane wrote:
> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> On 16/07/18 04:40, David Fetter wrote:
>>> Per a discussion with Andrew Gierth and Vik Fearing, both of whom
>>> helped make this happen, please find attached a patch which makes it
>>> possible to get SQL standard behavior for "= NULL", which is an error.
>>> It's been upgraded to a warning, and can still be downgraded to
>>> silence (off) and MS-SQL-compatible behavior (on).
>>
>> I don't agree with changing the default to 'warn'. "foo = NULL" is
>> perfectly legal SQL, even if it's not very useful in practice.
>
> I think that there's a very narrow argument to be made that SQL doesn't
> allow a NULL literal with context-determined type in this context. But
> we decided to generalize that restriction long ago, and suddenly deciding
> to enforce it only in this one context makes no sense to me. The idea
> that we would ever decide that it's an error seems flat out ridiculous.
>
> TBH I'm not really excited about investing any work in this area at all.
> Considering how seldom we hear any questions about transform_null_equals
> anymore[1], I'm wondering if we couldn't just rip the "feature" out
> entirely.
Yeah, I was wondering about that too. But Fabien brought up a completely
new use-case for this: people learning SQL. For beginners who don't
understand the behavior of NULLs yet, I can see a warning or error being
useful training wheels. Perhaps a completely new "training_wheels=on"
option, which could check may for many other beginner errors, too, would
be better for that.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2018-07-16 15:21:22 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Tom Lane 2018-07-16 15:10:27 Re: Make foo=null a warning by default.