Re: [HACKERS] Re: NULL & NOT NULL

From: "Jose' Soares" <jose(at)sferacarta(dot)com>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, lockhart(at)alumni(dot)caltech(dot)edu, hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: NULL & NOT NULL
Date: 1998-12-29 14:43:13
Message-ID: 3688EA81.15DF76BD@sferacarta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
>
> > "Thomas G. Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> > >>>>>> create table authors (
> > >>>>>> zip char(5) null
> > >>>>>> );
> >
> > > Sheesh. After that long song and dance about why we can't implement
> > > this, it turns out that it works fine. We had been trying to implement a
> > > slightly different syntax, "WITH NULL", which conflicted with the
> > > SQL92-defined data type declaration "TIMESTAMP WITH TIME ZONE".
> >
> > > The "Practical SQL Handbook"-compatible form will be available in the
> > > next full release of Postgres. Thanks.
> >
> > Now that we have the syntax problem straightened out: I'm still confused
> > about the semantics. Does a "NULL" constraint say that the field
> > *must* be null, or only that it *can* be null (in which case NULL is
> > just a noise word, since that's the default condition)? I had assumed
> > the former, but Bruce seemed to think the latter...
>
> Can be null. Noise word. At least that is what I rememeber Thomas
> saying, and because it was noise, we removed it. In fact, it doesn't
> look like the standard accepts it, but there is no reason we can't.

This NULL clause is not part of constraints it is a default option and
we already support it,
there's nothing like:
CREATE TABLE table1 (field1 type NULL) in SQL92.

but the following is SQL92 and it works on PostgreSQL:

prova=> CREATE TABLE table1 (field1 INTEGER DEFAULT NULL);
CREATE

SQL92 syntax:

11.5 <default clause>

Function

Specify the default for a column or domain.

Format

<default clause> ::=
DEFAULT <default option>

<default option> ::=
<literal>
| <datetime value function>
| USER
| CURRENT_USER
| SESSION_USER
| SYSTEM_USER
| NULL

-Jose'-

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-12-29 15:08:10 Stale porting list?
Previous Message Peter T Mount 1998-12-29 13:04:42 Problem with create user in latest CVS