Reply to Re: Why "id int(11) DEFAULT '0'"?

Your name:

Reply:


Posted by Geoff Berrow on 06/11/07 08:42

Message-ID: <kr5p6352pgvvgpaojgpagc1juvl2c232kb@4ax.com> from Gilles
Ganault contained the following:

>On Sat, 09 Jun 2007 12:30:08 +0100, Geoff Berrow
><blthecat@ckdog.co.uk> wrote:
>>Sheesh, I'm no sql whizz but even I can work out why that is nonsense.
>
>I know that, but it just seemed very strange that this error was found
>in the official package, and used as is in an application I was trying
>to install. If that's correcxt, then how come it doesn't work in MySQL
>4 and 5?

I can only assume that it is ignored in other versions.
>
>I ended removing DEFAULT '0' for the ID. Hopefully, that won't break
>the app somewhere down the line.

If DEFAULT '0' was doing anything, the application would be seriously
broken anyway. DEFAULT is used to insert a default value if none is
specified. But this column is the only primary key! It is not used in
conjunction with any other column. The primary key MUST be unique and
therefore cannot have a default value.

The only thing that might make sense is to have a starting value for the
auto-increment but you would set this in another way.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация