Re: example of insert timestamp

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

 




On Feb 25, 2008, at 8:19 PM, Gregory Williamson wrote:

Perhaps, make the column so it has a default value of now, land then insert without specifying the timestamp column so it gets the default value:

create table foo (q_i_time timestamp with time zone not null default now(), someval int);


This is what I do. For many tables, I also add a mod_time column with an ON UPDATE trigger similar to the one previously posted. Even when not needed for the table itself, in development, it can be very handy to compare dodgy inserts/updates with commit logs when bug hunting...

-j

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux