List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:April 5 2002 4:38pm
Subject:Re: Problems with UPDATE in v3.23.49 (is this a bug)
View as plain text  
At 18:33 +0200 4/5/02, Hihn Jason wrote:
>I have a table whose schema contains:
>id INTEGER AUTO_INCREMENT,
>gen_time TIMESTAMP,
>rec_time TIMESTAMP,
>repeats INTEGER DEFAULT 0,
>PRIMARY KEY (id),
>INDEX (rec_time))
>
>When I do an:
>UPDATE table SET repeats=repeats+1
>
>gen_time gets updated as well:

Of course.  That's how TIMESTAMP works.

The manual is your friend:

http://www.mysql.com/doc/D/A/DATETIME.html

>mysql> select id, gen_time, rec_time, repeats from table;
>+----+----------------+----------------+---------+
>| id | gen_time       | rec_time       | repeats |
>+----+----------------+----------------+---------+
>|  1 | 20020404164500 | 20020405111308 |       0 |
>+----+----------------+----------------+---------+
>1 row in set (0.01 sec)
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.01 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.02 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> update table set repeats=repeats+1 where id='1';
>Query OK, 1 row affected (0.02 sec)
>Rows matched: 1  Changed: 1  Warnings: 0
>
>mysql> select id, gen_time, rec_time, repeats from table;
>+----+----------------+----------------+---------+
>| id | gen_time       | rec_time       | repeats |
>+----+----------------+----------------+---------+
>|  1 | 20020405112158 | 20020405111308 |       3 |
>+----+----------------+----------------+---------+
>1 row in set (0.02 sec)
>
>Is this a bug or am I forgetting something?

Thread
Problems with UPDATE in v3.23.49 (is this a bug)Hihn Jason5 Apr
  • Re: Problems with UPDATE in v3.23.49 (is this a bug)denonymous5 Apr
  • RE: Problems with UPDATE in v3.23.49 (is this a bug)Basil Hussain5 Apr
RE: Problems with UPDATE in v3.23.49 (is this a bug)Rick Emery5 Apr
Re: Problems with UPDATE in v3.23.49 (is this a bug)Paul DuBois5 Apr
RE: Problems with UPDATE in v3.23.49 (is this a bug)Hihn Jason5 Apr
RE: Problems with UPDATE in v3.23.49 (is this a bug)Rick Emery5 Apr
Re: Problems with UPDATE in v3.23.49 (is this a bug)Joshua J . Kugler6 Apr