CREATE TABLE docs fix

Поиск
Список
Период
Сортировка
Искать

CREATE TABLE docs fix

От:
Neil Conway <neilc@samurai.com>
Дата:
Вложения:
This patch fixes a minor inaccuracy in the documentation: NOT NULL is
not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
constraint.

Cheers,

Neil

-- 
Neil Conway  || PGP Key ID: DB3C29FC

Re: CREATE TABLE docs fix

От:
Rod Taylor <rbt@zort.ca>
Дата:
On Sun, 2002-09-01 at 04:00, Neil Conway wrote:
> This patch fixes a minor inaccuracy in the documentation: NOT NULL is
> not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
> ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
> constraint.

Yeah, but they're still synonymous.

Re: CREATE TABLE docs fix

От:
Neil Conway <neilc@samurai.com>
Дата:
Rod Taylor  writes:

> On Sun, 2002-09-01 at 04:00, Neil Conway wrote:
> > This patch fixes a minor inaccuracy in the documentation: NOT NULL
> > is not synonymous with CHECK (xxx IS NOT NULL) -- for example,
> > consider ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL',
> > not a check constraint.
> 
> Yeah, but they're still synonymous.

How so? Their behavior is clearly different (note the case above, as
well as any other situation in which the system attempts to determine
if a column allows a NULL value).

Since they are not interchangeable, they can't be synonyms.

Cheers,

Neil

-- 
Neil Conway  || PGP Key ID: DB3C29FC

Re: CREATE TABLE docs fix

От:
Rod Taylor <rbt@zort.ca>
Дата:
On Sun, 2002-09-01 at 13:28, Neil Conway wrote:
> Rod Taylor  writes:
> 
> > On Sun, 2002-09-01 at 04:00, Neil Conway wrote:
> > > This patch fixes a minor inaccuracy in the documentation: NOT NULL
> > > is not synonymous with CHECK (xxx IS NOT NULL) -- for example,
> > > consider ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL',
> > > not a check constraint.
> > 
> > Yeah, but they're still synonymous.
> 
> How so? Their behavior is clearly different (note the case above, as
> well as any other situation in which the system attempts to determine
> if a column allows a NULL value).
> 
> Since they are not interchangeable, they can't be synonyms.

The case you brought up is more of a bug or mis-implementation of alter
table / add primary key. I guess you're right. They're not, but they
should be.



Re: CREATE TABLE docs fix

От:
Alvaro Herrera <alvherre@atentus.com>
Дата:
En 01 Sep 2002 13:44:37 -0400
Rod Taylor  escribió:

> > > On Sun, 2002-09-01 at 04:00, Neil Conway wrote:
> > > > This patch fixes a minor inaccuracy in the documentation: NOT NULL
> > > > is not synonymous with CHECK (xxx IS NOT NULL) -- for example,
> > > > consider ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL',
> > > > not a check constraint.
> 
> The case you brought up is more of a bug or mis-implementation of alter
> table / add primary key. I guess you're right. They're not, but they
> should be.

I think it's very difficult in the general case to determine from a
CHECK constraint if it is setting some column to not null; but if it was
easy, then you better translate(*) it into the SET NOT NULL form, and leave
the ADD PRIMARY KEY code alone.

Anyway IMHO this should be documented to prevent possible confusion.


(*) but I think auto-converting some things into some other things that
may not be what the user wants is a recipe for user frustration.

-- 
Alvaro Herrera ()
"El sabio habla porque tiene algo que decir;
el tonto, porque tiene que decir algo" (Platon).

Re: CREATE TABLE docs fix

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Is this patch to be applied?

---------------------------------------------------------------------------

Neil Conway wrote:
> This patch fixes a minor inaccuracy in the documentation: NOT NULL is
> not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
> ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
> constraint.
> 
> Cheers,
> 
> Neil
> 
> -- 
> Neil Conway  || PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/ref/create_table.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/create_table.sgml,v
retrieving revision 1.55
diff -c -r1.55 create_table.sgml
*** doc/src/sgml/ref/create_table.sgml	18 May 2002 15:44:47 -0000	1.55
--- doc/src/sgml/ref/create_table.sgml	1 Sep 2002 07:52:51 -0000
***************
*** 247,255 ****
      NOT NULL</>
      
       
!       The column is not allowed to contain NULL values.  This is
!       equivalent to the column constraint CHECK (column NOT NULL).
       
      
     
--- 247,253 ----
      NOT NULL</>
      
       
!       The column is not allowed to contain NULL values.
       
      
     

Re: CREATE TABLE docs fix

От:
Neil Conway <neilc@samurai.com>
Дата:
Bruce Momjian  writes:
> Is this patch to be applied?

Yes, IMHO anyway.

Cheers,

Neil

-- 
Neil Conway  || PGP Key ID: DB3C29FC

Re: CREATE TABLE docs fix

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Your patch has been added to the PostgreSQL unapplied patches list at:

	http://207.106.42.251/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch fixes a minor inaccuracy in the documentation: NOT NULL is
> not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
> ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
> constraint.
> 
> Cheers,
> 
> Neil
> 
> -- 
> Neil Conway  || PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: CREATE TABLE docs fix

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

Patch applied.  Thanks.

---------------------------------------------------------------------------


Neil Conway wrote:
> This patch fixes a minor inaccuracy in the documentation: NOT NULL is
> not synonymous with CHECK (xxx IS NOT NULL) -- for example, consider
> ALTER TABLE ADD PRIMARY KEY, which checks for 'NOT NULL', not a check
> constraint.
> 
> Cheers,
> 
> Neil
> 
> -- 
> Neil Conway  || PGP Key ID: DB3C29FC

[ Attachment, skipping... ]

> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
FAQ