Re: I was spoiled by the MySQL timestamp field

From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
To: dev(at)archonet(dot)com
Cc: "Alan T(dot) Miller" <amiller(at)hollywood101(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: I was spoiled by the MySQL timestamp field
Date: 2003-01-23 19:31:32
Message-ID: 3E304314.905@intransa.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Of course the proposed solution solves the INSERTs....you can also set a
trigger that
on UPDATE set the value to 'now()'

dev(at)archonet(dot)com wrote:

>>As someone who is just getting started with PostygreSQL from years working
>>with MySQL, it appears that the timestamp data type does not behave in the
>>way it did with MySQL.
>>
>>
>
>Much as I like MySQL, it can sometimes be a little *too* helpful.
>
>
>
>>I got used to just defining a column as a timestamp
>>and letting the database throw the latest time stamp in there whenever a
>>row
>>was updated. Is there anything simular in PosgreSQL?
>>
>>
>
>When you create the table do something like:
>
>CREATE TABLE foo (
> bar timestamp DEFAULT now(),
> ...
>);
>
>You can of course do this with any column-type and value. See the
>SQL-reference for details.
>
>- Richard Huxton
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tilo Schwarz 2003-01-23 19:31:55 psql 7.3.1 crash
Previous Message Medi Montaseri 2003-01-23 19:26:42 Re: embedded postgres