Re: postgresql vs mysql

From: Tommy Gildseth <tommy(at)gildseth(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: postgresql vs mysql
Date: 2007-02-23 16:34:55
Message-ID: 45DF17AF.1040902@gildseth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-02-23 16:37:06 Re: ODBCng and OpenOffice 2.1
Previous Message Joshua D. Drake 2007-02-23 16:33:47 Re: PGSQL Locking vs. Oracle's MVCC