Bug #38123 Set clause in update also accepts DEFAULT

Submitted: 15 Jul 2008 7:56 Modified: 15 Jul 2008 17:25
Reporter: Kay Roepke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[15 Jul 2008 7:56] Kay Roepke
Description:
The documentation at http://dev.mysql.com/doc/refman/5.1/en/update.html states that the SET clause for the UPDATE statement contains a column name and expression pair.
In fact you can use either an expression or DEFAULT (like with INSERT and REPLACE)

How to repeat:
Execute the following statements to see that it works.

CREATE TABLE `uptest` (
  `a` int(11) NOT NULL DEFAULT '0',
  `b` int(11) NOT NULL DEFAULT '42',
  PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

mysql> insert into uptest set a=0, b=0;
Query OK, 1 row affected (0.01 sec)

mysql> update uptest set a=1, b=DEFAULT where a=0;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from uptest;
+---+----+
| a | b  |
+---+----+
| 1 | 42 | 
+---+----+
1 row in set (0.00 sec)

Suggested fix:
Change the syntax description expr1|DEFAULT in the UPDATE reference.
[15 Jul 2008 7:57] Kay Roepke
Note that this behavior is different to using the DEFAULT() function, it is a syntax element at this point.
[15 Jul 2008 17:25] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.