Search Postgresql Archives

create table foo( ... ..., _date date default current_date, ... ... );

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Group,
I want to set the default value of a date attribute _date to  CURRENT_DATE.
CURRENT_DATE gives a format    YYYY-MM-DD

my table is something similar to:

create table foo(
...  ...,
_date date default current_date,
... ...);

Now, everytime a new entry is inserted, is it going to get the CURRENT_DATE of the day of insertion? Or will this be the same value all of the time?

The behavior I'd like is, if today is   2006-10-01,
all new entries today will get that as default.
Then tomorrow   2006-10-02
all entries will get 2006-10-02 as the default.

when I do a:
\d foo

sseq           | integer               |
_iseq          | integer               |
_comment       | text                  |
_day           | character varying(3)  |
_time          | character varying(5)  |
_meridiem      | character varying(2)  |
_paymentamount | character varying(13) |
_date          | date                  | default ('now'::text)::date
Foreign-key constraints:
"paymenthistory__iseq_fkey" FOREIGN KEY (_iseq) REFERENCES instructor(_iseq)
   "paymenthistory_sseq_fkey" FOREIGN KEY (sseq) REFERENCES students(sseq)

Is this going to give the desired behavior?

Thanks,

--
Email:    louis.gonzales@xxxxxxxxxxxxxx
WebSite:  http://www.linuxlouis.net
"Open the pod bay doors HAL!" -2001: A Space Odyssey
"Good morning starshine, the Earth says hello." -Willy Wonka



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux