Unix Technical Forum

What is the syntax for setting a default date in PostgreSQL?

This is a discussion on What is the syntax for setting a default date in PostgreSQL? within the Pgsql General forums, part of the PostgreSQL category; --> This issue always stumps me. I need to set the default date for a column in postgres. A value ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 08:28 AM
Frank Church
 
Posts: n/a
Default What is the syntax for setting a default date in PostgreSQL?


This issue always stumps me. I need to set the default date for a column in
postgres. A value for today, today + x days, now (timestamp), now + x amount of
days.

I never seem to be able to locate it in the documentation or online. Can anyone
post it here once and for all for posterity?

I will be much obliged


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 08:28 AM
Alban Hertroys
 
Posts: n/a
Default Re: What is the syntax for setting a default date in PostgreSQL?

Frank Church wrote:
> This issue always stumps me. I need to set the default date for a column in
> postgres. A value for today, today + x days, now (timestamp), now + x amount of
> days.


CURRENT_DATE, CURRENT_DATE + x, now(), now() + 'x days'::interval are a
few options.

--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com