Re: I was spoiled by the MySQL timestamp field

From: Joseph Shraibman <jks(at)selectacast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: I was spoiled by the MySQL timestamp field
Date: 2003-01-23 23:03:41
Message-ID: b0pscc$950$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

See http://www.brasileiro.net:8080/postgres/cookbook/view-one-recipe.adp?recipe_id=10

Matthew Nuzum wrote:
> One word of caution, I *think* you want quotes around the 'now()'
> statement in your table definition. Otherwise your default value will be
> the instant the *table* was created, not the instant your insert
> happened.
>
> I too had an adjustment period when switching from MySQL to postgres.
> However, I think you'll find that if you use a RULE to implement this
> feature you will soon become addicted to PostgreSQL's advanced feature
> set.
>
> You can learn more about rules by going to
> http://www.ca.postgresql.org/docs/aw_pgsql_book/node124.html where you
> can find a brief description and example, or for more detail, you can go
> to
> http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/rules-insert
> .html
>
> I attained all of my database knowledge through hands on experience;
> much of it on MySQL. Switching to PostgreSQL was somewhat traumatic
> because it has a lot more power and a lot more features. Once I got a
> handle on things like Views, Triggers and Rules, I have become somewhat
> dependant on them and I haven't been able to use MySQL for anything more
> than the most basic of applications. I guess that's just a warning...
> There may be no turning back.
>
> --
> Matthew Nuzum
> www.bearfruit.org
> cobalt(at)bearfruit(dot)org
> =20
>
>
>>-----Original Message-----
>>From: Bj=F6rn Metzdorf [mailto:bm(at)turtle-entertainment(dot)de]
>>Sent: Thursday, January 23, 2003 7:32 AM
>>To: Alan T. Miller; pgsql-general(at)postgresql(dot)org
>>Subject: Re: I was spoiled by the MySQL timestamp field
>>=20
>>
>>>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. 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? How can I
>>
>>accomplish
>>
>>>something simular inside the database, or am I stuck populating the
>>
>>field
>>in
>>
>>>some manner as in the following example
>>
>>=20
>>There is no such datatype in postgresql. If you just need the current
>
> time
>
>>inserted on INSERT and not on UPDATE, then you can declare that column
>>with
>>"default now()". Else you will need to install a trigger, then you can
>>have
>>exactly the same behaviour as with mysql.
>>=20
>>Regards,
>>Bjoern
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-01-23 23:30:49 Re: standard schemas for addresses, others?
Previous Message Luke Pascoe 2003-01-23 23:02:40 Inherited tables and NOT NULL (pg 7.2.1)