Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-1.x-dev
Component:
content.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2006 at 15:12 UTC
Updated:
26 Dec 2006 at 15:45 UTC
Jump to comment: Most recent file
Comments
Comment #1
karens commentedBTW, the relevant function is content_db_add_column() which is the code that creates the db field columns.
Comment #2
heine commentedMySQL doesn't support DEFAULT values on TEXT or BLOB columns. When running in strict mode MySQL 5 will complain (loudly). We just removed default values from core.
Comment #3
yched commentedAs a matter of fact, I was not aware of the post Karen mentioned, but I saw the core patch a few days ago, and investigated text.module.
From my tests, MySQL 4.1 was in fact rejecting
ALTER TABLE `foo` ADD `bar` LONGTEXT DEFAULT 'baz' ;, butaccepted with no errors
ALTER TABLE `foo` ADD `bar` LONGTEXT DEFAULT '' ;andALTER TABLE `foo` ADD `bar` LONGTEXT DEFAULT NULL ;(the latter if the column is not specified NOT NULL, of course...)So I did not touch anything in text.module, and simply added a comment saying 'this should not work but looks okay for now' (I did not commit that yet...)
But if MySQL 5 rejects it, I guess we have to correct this.
Comment #4
yched commentedAttached patch should correct this - before committing, I'd like someone with a MySQL 5 install to confirm, though...
Patch is for 5 branch, but should apply easily on 4.7
Comment #5
yched commentedComment #6
karens commentedyched, I was also looking at the content_db_add_column() function. I think we need a fix there so that default values don't get attached to text fields. That would keep any field module from inadvertently trying to provide a default value.
Also, I assume that providing no default value is also the right behavior for postgres??
Comment #7
karens commentedAnd if we alter that function we can remove the default completely rather than trying to do default NULL, just in case that is a problem in some dbs.
Comment #8
yched commentedMaybe you're right.
After all, it's a 'db-type' specific issue, and it's probably up to content.module to handle the db specifics.
I still think we have to keep the 'default' param in the field definition, though.
Comment #9
yched commentedAttached patch does the check in the mysql part of content_db_add_column().
(from the online reference, pgsql seems OK with default values for any column type)
This cancels my previous patch for text.module, which is not needed - and not wanted, aamof.
Comment #10
karens commentedLooks good to me. Committed. Thanks yched.
Comment #11
(not verified) commented