pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jose soares <jose@sferacarta.com>
To: Jan Wieck <wieck@debis.com>
Cc: bruce@cenderis.demon.co.uk
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] NULL
Date: Wed, 17 Nov 1999 14:56:16 +0100
Message-ID: <3832B3FF.A3F3F9F1@sferacarta.com> (raw)
References: <m11njOy-0003kLC@orion.SAPserv.Hamburg.dsh.de>



Jan Wieck ha scritto:

> > > > It suppose to mean that NULLs are explicitly allowed in
> > > > this field.
> > > > Is this required by SQL-92?
> > >
> > > No, it's not required.  This came up before with the examples from
> > > "The Practical SQL Handbook".  It would be nice to allow it, but there
> > > was some reason why to do so would be non-trivial, which I forget.
> > > Anyway, it's not in SQL-92.
> > >
> > Sorry, I don't understand why we need this feature. This is completely ou=
> > t
> > of standard.
> >
> > What's that mean ?
> >
> > -  Is it a constraint to allow only NULL values ?  (unuseful)
>
>     Useless? I NEED IT - URGENT - NOW - YESTERDAY.
>
>     Then  I  could  create my tables with all required fields for
>     the future, but prevent that  someone  stores  data  in  them
>     until I drop the constraint.

Maybe I miss something here, Jan...I think you don't need such thing to do this
kind of work.

To drop the constraint you have:
    1) download the table
    2) modify the table structure (without constraint NULL)
    3) re-create the table
    4) reload it again.

You have the same effect as:
    1) download the table
    2) add new filelds to table structure
    3) re-create the table
    4) reload it again

...but, if want these fields from the begining you may create a CHECK contraint
for the field, like:

CREATE TABLE distributors (
        did      DECIMAL(3),
        name     VARCHAR(40),
        avoid    INTEGER
        CONSTRAINT con1 CHECK (avoid is NULL)
        );

insert into distributors values (33,'PIPPO',123);
ERROR:  ExecAppend: rejected due to CHECK constraint con1
insert into distributors values (33,'PIPPO',NULL);
INSERT 1484300 1
select * from distributors;
did|name |avoid
---+-----+-----
 33|PIPPO|
(1 row)

...and this is SQL-92 Standard   ;)

José




view thread (18+ messages)  latest in thread

Message-ID: <3832B3FF.A3F3F9F1@sferacarta.com>
Permalink:  ../3832B3FF.A3F3F9F1@sferacarta.com/
Also on:    postgresql.org/message-id/3832B3FF.A3F3F9F1@sferacarta.com

 · 

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: jose@sferacarta.com, wieck@debis.com, bruce@cenderis.demon.co.uk
  Subject: Re: [SQL] NULL
  In-Reply-To: <3832B3FF.A3F3F9F1@sferacarta.com>

* 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