From: Jeff Smelser Date: November 4 2005 3:42pm Subject: Re: MySQL 5.0 : error using max(idrow) on a null value List-Archive: http://lists.mysql.com/mysql/191255 Message-Id: <200511040942.11997.tradergt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1325177.MJBYXQUfZA"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1325177.MJBYXQUfZA Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 04 November 2005 07:30 am, AESYS S.p.A. [Enzo Arlati] wrote: > Hi, I'm trying to migrate from MySQL 4.1.11 to MySQL 5.0 and I get a > problem with the new release. > I have this table... > > provasql > CREATE TABLE `provasql` > > `idrow` bigint(20) unsigned NOT NULL default '0', > `descr` varchar(50) default NULL, > PRIMARY KEY (`idrow`) > ) ENGINE=3DInnoDB DEFAULT CHARSET=3Dlatin1 > > > ...this is the SQL command... > > insert into provasql ( idrow, descr ) > select ( select max(c.idrow)+1 from provasql c ) , 'This is only a test'; > > > ...and this is the error: > > ERROR 1263 (22004): Column set to default value; NULL supplied to NOT NULL > colum > n 'idrow' at row 1 > > > With MySQL 4.1.11 I'd never get this error message, but it happens with t= he > 5.0.15 version. > Can anyone help me? Mysql 5 is much more picky on things you shouldnt have been able to do in t= he=20 first place.. Just change idrow to auto_increment and stop doing max.. Its= =20 not needed. innodb properly handles auto_increment now. Jeff --nextPart1325177.MJBYXQUfZA Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDa4FToOk9EvUvEtgRAny4AJ93F43yJv2lKyT+rYMp5WxAT8NFkQCg5WRP R/hbDRrnTjsgizU1CIiyxT0= =ya07 -----END PGP SIGNATURE----- --nextPart1325177.MJBYXQUfZA--