Welcome Guest, Not a member yet? Register   Sign In
CI Session bug
#1

[eluser]Nemke[/eluser]
It's late and I'm pretty much tired but isn't this a bug:

1. Please first look at this:

http://dev.mysql.com/doc/refman/4.1/en/blob.html
http://dev.mysql.com/doc/refman/5.0/en/blob.html
http://dev.mysql.com/doc/refman/5.1/en/blob.html
http://dev.mysql.com/doc/refman/5.5/en/blob.html

as you can see for eache version of MySQL there is this line of text

"BLOB and TEXT columns cannot have DEFAULT values."

and if you go to User Guide and look a page about Session library:

http://ellislab.com/codeigniter/user-gui...sions.html

you will notice this database structure:

"CREATE TABLE IF NOT EXISTS `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(50) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text DEFAULT '' NOT NULL,
PRIMARY KEY (session_id)
);"


in which as you can see user_data is TEXT type field and is declared with default value. So can anybody tell me is this a bug, or I'm I just to tired Smile
#2

[eluser]wh1tel1te[/eluser]
I assume MySQL will ignore the default value for the text field when creating a table.

I just tested adding a default value to a text field in MySQL 5.0.77, this is the result:

Code:
SQL query:
ALTER TABLE  `blog1_post` CHANGE  `post_content`  `post_content` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT  'test'

MySQL said:
#1101 - BLOB/TEXT column 'post_content' can't have a default value
#3

[eluser]WanWizard[/eluser]
When creating a session table, remove 'NOT NULL' from the user_data column. A session record is actually created without data, and since it can't have a default value, the INSERT fails with an error.

This is an error in the docs...




Theme © iAndrew 2016 - Forum software by © MyBB