How to setup default value "0000-00-00" for "date" type under PostgreSQL?

From: Emi Lu <emilu(at)cs(dot)concordia(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: How to setup default value "0000-00-00" for "date" type under PostgreSQL?
Date: 2004-08-18 14:45:01
Message-ID: 41236B6D.5000606@cs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

I have a question about "date" & "timestamp" types in PostgreSQL. I want
to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for
them. However, it seems that PostgreSQL does not support it. Could
someone helps me please?

The example table:

T1 (col1 varchar(7) not null,
col2 varchar(4) not null,
col3 date not null,
col 4 varchar(3),
primary key(col1, col2, col3)
)

In my design model, "col3" has to be one of the primary key part. Since
at the beginning of the data population, we do not know the value of
"col3"; values for "col3" are input throught GUI. Therefore, when I use
MySQL, the default values I gave is "0000-00-00". However, after I
migrate to postgreSQL, I could not setup the default values as
"0000-00-00" any more. Could somebody help me about it please? I really
want to know how I can save '0000-00-00' as the default value for "date"
and "timestamp" types.

Thanks a lot!
Emi Lu

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Adler 2004-08-18 14:46:41 Re: tracking db changes / comparing databases
Previous Message Gaetano Mendola 2004-08-18 14:44:35 Re: (S)RPMS for 7.4.4 released.