Re: postgresql vs mysql - Mailing list pgsql-general

From Tommy Gildseth
Subject Re: postgresql vs mysql
Date
Msg-id 45DF17AF.1040902@gildseth.com
Whole thread Raw
In response to Re: postgresql vs mysql  (Ben <bench@silentmedia.com>)
List pgsql-general
Ben wrote:
> I'm sorry maybe I missed something, but if you don't need NULLs and
> feel they just add extra work, why don't you just declare all your
> columns to be not null and have them default to zero or an empty string?

....which is what mySQL does by default :-)
The statement
CREATE TABLE foo (bar INTEGER NOT NULL, rab VARHCAR(123) NOT NULL, oof
DATETIME NOT NULL,);
will be rewritten automatically by mySQL to
CREATE TABLE foo (bar INTEGER NOT NULL DEFAULT 0, rab VARHCAR(123) NOT
NULL DEFAULT '', oof DATETIME NOT NULL DEFAULT '0000-00-00 00:00');

Maybe if you really want to enforce a NOT NULL constraint in mySQL, you
have to declare a column as NOT NULL DEFAULT NULL, explicitly as was
suggested somewhere else in this thread. Fascinating how they probably
thought that was a good idea.

--
Tommy


pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: PGSQL Locking vs. Oracle's MVCC
Next
From: "Joshua D. Drake"
Date:
Subject: Re: ODBCng and OpenOffice 2.1