pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Wright <mwright@pro-ns.net>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] NOT NULL and postgres 6.5.2
Date: Mon, 18 Oct 1999 08:47:41 -0500
Message-ID: <001e01bf196f$5c1bc010$c62812ac@markw_compaq> (raw)

From: Oliver Elphick <olly@lfix.co.uk>
To: Stephan Bauer <stephan_bauer@gmx.de>
Cc: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Date: Saturday, October 16, 1999 1:58 PM
Subject: Re: [SQL] NOT NULL and postgres 6.5.2


>Stephan Bauer wrote:
>  >Hello all,
>  >
>  >I have an table like this:
>  >
>  >CREATE TABLE anzeigen (
>  >...
>  >
>  >        name                    varchar(30) NOT NULL,
>  >...
>  >);
>  >
>  >The following statement _will_ be inserted:
>  >
>  >INSERT INTO anzeigen ( ... name ...)
>  >VALUES ( ..., '', ...);
>  >
>  >What is my problem?
>
>An empty string is not the same as null.  It is a real value whereas null
>is an unknown/undefined/irrelevant value.


Stephan, I bet you're coming from the Oracle world, where '' is the same as
NULL.

(No lie.  Check this out:

    SQL> create table test_null (id number, name varchar(20) not null);

    Table created.

    SQL> insert into test_null values (1, '');
    insert into test_null values (1, '')
                *
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("SYSTEM"."TEST_NULL"."NAME")

This little bug can be _really_ irritating.

Mark.






view thread (4+ messages)

Message-ID: <001e01bf196f$5c1bc010$c62812ac@markw_compaq>
Permalink:  ../001e01bf196f$5c1bc010$c62812ac@markw_compaq/
Also on:    postgresql.org/message-id/001e01bf196f$5c1bc010$c62812ac@markw_compaq

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: mwright@pro-ns.net
  Subject: Re: [SQL] NOT NULL and postgres 6.5.2
  In-Reply-To: <001e01bf196f$5c1bc010$c62812ac@markw_compaq>
  References: <001e01bf196f$5c1bc010$c62812ac@markw_compaq>

* 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