Re: Blank date field.. Help...

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, ryan(at)fdcsmail(dot)darktech(dot)org
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Blank date field.. Help...
Date: 2002-07-17 11:18:14
Message-ID: 200207171218.15905.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 17 Jul 2002 6:43 am, Bruce Momjian wrote:
> ryan(at)fdcsmail(dot)darktech(dot)org wrote:
> > Hi,
> > Is there any way that I can do, just to make my date columns to accept
> > null/blank values? I use the latest stable version.
>
> Uh, you sure can. Can you show us the query that is failing. Unless
> the column is marked as NOT NULL, inserting a NULL should be fine. It
> will not accept '', only NULL.

Those trying to produce cross-platform SQL should be aware that MySQL does
accept blank dates. It gets silently converted to "0000-00-00". This is
considered a feature (check their online manual for details).

Got bitten by this with a bug in one of my apps - couldn't understand what was
happening until I looked at the data being stored.

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Gibbs 2002-07-17 12:22:57 Re: Using index with order desc
Previous Message stefan 2002-07-17 10:14:10 sequence id