lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Tue, Jun 5, 2018 at 10:08 AM, Sam Putman <atmanistan@gmail.com> wrote:


On Tue, Jun 5, 2018 at 10:02 AM, Javier Guerra Giraldez <javier@guerrag.com> wrote:


On 5 June 2018 at 17:29, Sam Putman <atmanistan@gmail.com> wrote:
That's not entirely fair.  I was neck deep in SQL, and wanted to see if evaluation
could be adjusted to match the three-valued logic.

The advantages are considerable!


perhaps it's because of long exposure to c-style short circuiting logic; but i generally find the SQL NULL behaviour heavy and hard to tame.  any non-trivial _expression_ quickly becomes a tangle of special cases to handle NULLs, and choosing the exact operator/cast function is a nightmare.

can you point some references that make it all "click" and see what i'm missing? 



SQL is old and therefore messy, you have awfulness like Oracle casting "" to NULL.

Also, SQL values get translated to language values, and casting SQL null to Java null 
is a mistake, C NULL would of course be a disaster.
I can still remember the day and a half of pain when learning that C# null is not the same as SQL Server null. Nope, you need to use DBNull.Value to check for NULL in a column. Grrrr.


In "pure" three-valued SQL logic, NULL means "this value is not known". 

Consider the difference between someone who tells the barista "Prince" when asked
his name, and Prince, the artist.  Prince the artist has last_name = false; Prince the 
coffee enthusiast has last_name = NULL.