473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[authlib] Why "id int(11) DEFAULT '0'"?

Hello

(Sorry for asking this in a PHP ng, but I already asked in a MySQL
forum, but got no definitive answer):

I'm trying to install the authlib module that's required for
the open-source iOutliner web-based outliner (http://ioutliner.com),
but it fails halfway through when creating the tables:

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_data (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name text NOT NULL,
email text NOT NULL,
age int(3) DEFAULT '0' NOT NULL,
sex text NOT NULL,
school text NOT NULL,
PRIMARY KEY (id)
)");

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_login (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
PRIMARY KEY (id)
)");

According to Google, DEFAULT '(0)' seems a legit instruction. Indeed,
if I remove this part, it creates the table.

But this error is found in both the authlib 1.96 that comes with
iOutliner and the original file on Sourceforge:

http://sourceforge.net/project/showf...group_id=20743

Could it be that it's a legal bit when MySQL is compiled in a
particular way?

Thank you.
Jun 8 '07 #1
11 4516
On Jun 8, 5:04 pm, Gilles Ganault <nos...@nospam.comwrote:
Hello

(Sorry for asking this in a PHP ng, but I already asked in a MySQL
forum, but got no definitive answer):

I'm trying to install the authlib module that's required for
the open-source iOutliner web-based outliner (http://ioutliner.com),
but it fails halfway through when creating the tables:

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_data (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name text NOT NULL,
email text NOT NULL,
age int(3) DEFAULT '0' NOT NULL,
sex text NOT NULL,
school text NOT NULL,
PRIMARY KEY (id)
)");

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_login (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
PRIMARY KEY (id)
)");

According to Google, DEFAULT '(0)' seems a legit instruction. Indeed,
if I remove this part, it creates the table.

But this error is found in both the authlib 1.96 that comes with
iOutliner and the original file on Sourceforge:

http://sourceforge.net/project/showf...group_id=20743

Could it be that it's a legal bit when MySQL is compiled in a
particular way?

Thank you.
Remove the quotes around 0.

Jun 8 '07 #2
On Fri, 08 Jun 2007 21:19:11 -0000, ZeldorBlat <ze********@gmail.com>
wrote:
>Remove the quotes around 0.
It doesn't work any better:

mysqlCREATE TABLE authlib_data (id int(11) DEFAULT 0 NOT NULL
auto_increment,age int(3) DEFAULT 0 NOT NULL, PRIMARY KEY (id));

ERROR 1067 (42000): Invalid default value for 'id'

Thanks.
Jun 8 '07 #3
Gilles Ganault wrote:
Hello

(Sorry for asking this in a PHP ng, but I already asked in a MySQL
forum, but got no definitive answer):

I'm trying to install the authlib module that's required for
the open-source iOutliner web-based outliner (http://ioutliner.com),
but it fails halfway through when creating the tables:

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_data (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name text NOT NULL,
email text NOT NULL,
age int(3) DEFAULT '0' NOT NULL,
sex text NOT NULL,
school text NOT NULL,
PRIMARY KEY (id)
)");

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_login (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
PRIMARY KEY (id)
)");

According to Google, DEFAULT '(0)' seems a legit instruction. Indeed,
if I remove this part, it creates the table.

But this error is found in both the authlib 1.96 that comes with
iOutliner and the original file on Sourceforge:

http://sourceforge.net/project/showf...group_id=20743

Could it be that it's a legal bit when MySQL is compiled in a
particular way?

Thank you.

DEFAULT and auto_increment on the same column? Why, why, oh my dear God
why? :)
Jun 8 '07 #4
On Fri, 08 Jun 2007 23:44:46 +0200, Denis Gerina <de***@cced.ba>
wrote:
>DEFAULT and auto_increment on the same column? Why, why, oh my dear God
why? :)
Same here ;-)

I removed DEFAULT '0' from the ID key. I'll see if that's a problem.

I'm stuck further down the road. This library is a total mess :-/ The
joys of open-source...
Jun 8 '07 #5
Gilles Ganault wrote:
Hello

(Sorry for asking this in a PHP ng, but I already asked in a MySQL
forum, but got no definitive answer):

I'm trying to install the authlib module that's required for
the open-source iOutliner web-based outliner (http://ioutliner.com),
but it fails halfway through when creating the tables:

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_data (
id int(11) DEFAULT '0' NOT NULL auto_increment,
name text NOT NULL,
email text NOT NULL,
age int(3) DEFAULT '0' NOT NULL,
sex text NOT NULL,
school text NOT NULL,
PRIMARY KEY (id)
)");

//Bad! /* SQL Error: Invalid default value for 'id' */
$query = mysql_query("CREATE TABLE authlib_login (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username text NOT NULL,
password text NOT NULL,
PRIMARY KEY (id)
)");

According to Google, DEFAULT '(0)' seems a legit instruction. Indeed,
if I remove this part, it creates the table.

But this error is found in both the authlib 1.96 that comes with
iOutliner and the original file on Sourceforge:

http://sourceforge.net/project/showf...group_id=20743

Could it be that it's a legal bit when MySQL is compiled in a
particular way?

Thank you.
You got a perfectly good (and perfectly correct) response from Willem
Bogaerts in comp.database.mysql with in 24 minutes of your original
posting. You even responded to it.

If you didn't like the answer, you should have requested a clarification
instead of taking to to another newsgroup where it's off-topic.

Or, since it's from Sourceforge, you should have asked in the project
support.

This is NOT the place to be asking mysql questions. That's why
comp.databases.mysql was created.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 9 '07 #6
Message-ID: <qf********************************@4ax.comfrom Gilles
Ganault contained the following:
>On Fri, 08 Jun 2007 21:19:11 -0000, ZeldorBlat <ze********@gmail.com>
wrote:
>>Remove the quotes around 0.

It doesn't work any better:

mysqlCREATE TABLE authlib_data (id int(11) DEFAULT 0 NOT NULL
auto_increment,age int(3) DEFAULT 0 NOT NULL, PRIMARY KEY (id));

ERROR 1067 (42000): Invalid default value for 'id'
Sheesh, I'm no sql whizz but even I can work out why that is nonsense.
auto_increment works in a similar way as DEFAULT adding a value if one
is not set in the sql except with auto_increment (and the clue is in the
name folks) a new unique number is added to the new row. Having both
must surely conflict and besides, DEFAULT would be redundant
--
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/
Jun 9 '07 #7
On Jun 9, 7:30 am, Geoff Berrow <blthe...@ckdog.co.ukwrote:
Message-ID: <qf********************************@4ax.comfrom Gilles
Ganault contained the following:
On Fri, 08 Jun 2007 21:19:11 -0000, ZeldorBlat <zeldorb...@gmail.com>
wrote:
>Remove the quotes around 0.
It doesn't work any better:
mysqlCREATE TABLE authlib_data (id int(11) DEFAULT 0 NOT NULL
auto_increment,age int(3) DEFAULT 0 NOT NULL, PRIMARY KEY (id));
ERROR 1067 (42000): Invalid default value for 'id'

Sheesh, I'm no sql whizz but even I can work out why that is nonsense.
auto_increment works in a similar way as DEFAULT adding a value if one
is not set in the sql except with auto_increment (and the clue is in the
name folks) a new unique number is added to the new row. Having both
must surely conflict and besides, DEFAULT would be redundant

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDshttp://www.ckdog.co.uk/rfdmaker/
Doh! I should have seen that, too. Thanks Geoff.

Jun 9 '07 #8
On Fri, 08 Jun 2007 22:57:13 -0400, Jerry Stuckle
<js*******@attglobal.netwrote:
>You got a perfectly good (and perfectly correct) response from Willem
Bogaerts in comp.database.mysql with in 24 minutes of your original
posting. You even responded to it.
Sorry, before making changes to the installer, I wished to get a
second opinion. Like going to the doctor, you know.
Jun 11 '07 #9
On Sat, 09 Jun 2007 12:30:08 +0100, Geoff Berrow
<bl******@ckdog.co.ukwrote:
>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 ended removing DEFAULT '0' for the ID. Hopefully, that won't break
the app somewhere down the line.

Thank you.
Jun 11 '07 #10
Gilles Ganault wrote:
On Fri, 08 Jun 2007 22:57:13 -0400, Jerry Stuckle
<js*******@attglobal.netwrote:
>You got a perfectly good (and perfectly correct) response from Willem
Bogaerts in comp.database.mysql with in 24 minutes of your original
posting. You even responded to it.

Sorry, before making changes to the installer, I wished to get a
second opinion. Like going to the doctor, you know.
Then ask for another opinion in comp.databases.mysql. You want to get a
second opinion for your doctor, you don't go to an auto mechanic, do
you? Ir if you're asking for a second opinion for a cardiologist, you
don't go to an orthopedic surgeon.

This group is for PHP questions, not MySQL ones. Now please take your
questions to a more appropriate newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 11 '07 #11
Message-ID: <kr********************************@4ax.comfrom Gilles
Ganault contained the following:
>On Sat, 09 Jun 2007 12:30:08 +0100, Geoff Berrow
<bl******@ckdog.co.ukwrote:
>>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/
Jun 11 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Russ Perry Jr | last post by:
I'm using "ID" and "Value" in the generic sense here... Let's say one page I had a <html:select> with a collection like this: <html:options collection="items" property="key"...
2
by: Konrad Mathieu | last post by:
Does this work in most browsers, namely MSIE? document.links.href or does it have to be document.links.href ?
13
by: Julia Peterwitz | last post by:
I have a function that works with explorer but not with netscape. The problem is the function at line 5. 1 fSetSelectedDay(myElement){ 2 /* 3 ... 4 */ 5 var elementText =...
4
by: Lokicer | last post by:
Hi, i am a c newbie, i write some code to get size of structs i compile and run it in VC6.0 //#pragma pack(1) typedef struct tag_NullMsg { int a; } tNullMsg; typedef struct tag_CharMsg
14
by: Matt | last post by:
I want to know if "int" is a primitive type, or an object? For example, the following two approaches yield the same result. > int t1 = int.Parse(TextBox2.Text); //method 1 > int t2 =...
1
by: easy.lin | last post by:
.... <object id="10">door</object> .... I try to write this in clipse XSD editor <element name="object" type="string"> <attribute name="id" type="int"></attribute> </element> but get wrong...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
13
by: Anna | last post by:
I try to put 8 int bit for example 10100010 into one character of type char(1 octet) with no hope . Could anyone propose a simple way to do it? Thank you very much.
2
by: mmiikkee13 | last post by:
>>a_list = range(37) .... print k, v .... Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'int' object is not iterable What 'int' object is this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.