CREATE TABLE docs fix

Started by Neil Conwayalmost 24 years ago9 messagespatches
Jump to latest
#1Neil 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 <neilc@samurai.com> || PGP Key ID: DB3C29FC

Attachments:

create_table_docs.patchtext/x-patchDownload+4-4
#2Rod Taylor
rbt@rbt.ca
In reply to: Neil Conway (#1)
Re: CREATE TABLE docs fix

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.

#3Neil Conway
neilc@samurai.com
In reply to: Rod Taylor (#2)
Re: CREATE TABLE docs fix

Rod Taylor <rbt@zort.ca> 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 <neilc@samurai.com> || PGP Key ID: DB3C29FC

#4Rod Taylor
rbt@rbt.ca
In reply to: Neil Conway (#3)
Re: CREATE TABLE docs fix

On Sun, 2002-09-01 at 13:28, Neil Conway wrote:

Rod Taylor <rbt@zort.ca> 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.

#5Alvaro Herrera
alvherre@atentus.com
In reply to: Rod Taylor (#4)
Re: CREATE TABLE docs fix

En 01 Sep 2002 13:44:37 -0400
Rod Taylor <rbt@zort.ca> 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 (<alvherre[a]atentus.com>)
"El sabio habla porque tiene algo que decir;
el tonto, porque tiene que decir algo" (Platon).

#6Bruce Momjian
bruce@momjian.us
In reply to: Neil Conway (#1)
Re: CREATE TABLE docs fix

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 <neilc@samurai.com> || 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

Attachments:

/bjm/doctext/plainDownload+4-4
#7Neil Conway
neilc@samurai.com
In reply to: Bruce Momjian (#6)
Re: CREATE TABLE docs fix

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Is this patch to be applied?

Yes, IMHO anyway.

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

#8Bruce Momjian
bruce@momjian.us
In reply to: Neil Conway (#1)
Re: CREATE TABLE docs fix

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 <neilc@samurai.com> || 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
#9Bruce Momjian
bruce@momjian.us
In reply to: Neil Conway (#1)
Re: CREATE TABLE docs fix

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 <neilc@samurai.com> || 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