Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have installed a fresh install of Drupal 4.6.4 with PHP version 5.0.5 and the latest MySQL 5 database. The following statements in the database script fail:
REPLACE blocks SET module = 'user', delta = '0', status = '1';
REPLACE blocks SET module = 'user', delta = '1', status = '1';
This is due to pages and types being not null and not having supplied values. I'm not sure if this is related, but I can only see the center column of any page on the site. I can't see the left menu area so I can't access administrative features. Haven't seen anyone else report this.
Comment | File | Size | Author |
---|---|---|---|
#21 | database.mysql.diff | 1.1 KB | drumm |
#12 | database.mysql_15.patch | 1.34 KB | moshe weitzman |
#6 | database.mysql_14.patch | 1.09 KB | eaton |
#2 | no_side_columns.png | 26.34 KB | NicolasH |
Comments
Comment #1
dopry CreditAttribution: dopry commentedunable to reporduce... setting to won't fix..
Comment #2
NicolasH CreditAttribution: NicolasH commentedI get the exact same error as well as missing the left and right column. By navigating directly to the block positioning admin screen I was able to activate the the left and right columns.
Since I get all sorts of other strange behaviour, I can not be sure whether this is related to the initial MySQL error, which makes trouble shooting very cumbersome.
Comment #3
Zen CreditAttribution: Zen commentedSetting this to CVS as the same statements still exist in database.mysql.
MySQL 5 strict mode issue?
-K
Comment #4
Heine CreditAttribution: Heine commentedYes, strict mode issues: Error 1364 upon importing database.mysql with MySQL 5.0+
Comment #5
chx CreditAttribution: chx commentedI always thought it's idiotic to use REPLACE there. I will roll a patch later.
Comment #6
eaton CreditAttribution: eaton commentedThis is painfully simple, indeed. Am I missing something? Is there any reason we used REPLACE?
Comment #7
eaton CreditAttribution: eaton commentedI have been informed that 'pages' still needs an explicit value in the insert statement, though chx and I are puzzling over this. We provide a default in the table creation script, and the simple INSERT statement seems to work on both my and his mysql setups, even when running in STRICT.
Can anyone apply this and see if they continue to encounter the problem?
Comment #8
dopry CreditAttribution: dopry commentedno problems on mysql 4.1.5
Comment #9
dopry CreditAttribution: dopry commentedoh there is a patch here eh?
Comment #10
chx CreditAttribution: chx commentedI am running STRICT_ALL_TABLES and yet i was able to create text and blob fields with default values. And also, even the REPLACE version imported for me. It seems like I need to spend more time with the mysql manual.
Comment #11
drummWhy would pages need anything other than an empty string?
Comment #12
moshe weitzman CreditAttribution: moshe weitzman commentedHere is eaton's patch plus a change to the 'pages' field so that it can be NULL. I see no reason to prevent that.
Comment #13
Cvbge CreditAttribution: Cvbge commentedI agree with chx and eaton, why do we need replace at all?
Comment #14
Dries CreditAttribution: Dries commentedI'm OK with Moshe's patch. Let's mark this RTBC if no one objects within a day or so.
Comment #15
chx CreditAttribution: chx commentedmoshe, there are no nulls in drupal if i remember correctly.
Comment #16
moshe weitzman CreditAttribution: moshe weitzman commentedI've certainly used NULLs in my modules. Really, this convention we have of NOT NULL DEFAULT '' is wordy and not needed. If someone objects to this patch, please do so quickly :)
Comment #17
drummAllowing NULL values should be used where useful, but I don't think this is such a case. Just put in an empty string for pages.
Comment #18
moshe weitzman CreditAttribution: moshe weitzman commentedi would state it differently - empty strings should only be used when useful - otherwise use NULL. to me that is simplest.
Comment #19
chx CreditAttribution: chx commentedanyways. let's get this in... :)
Comment #20
Cvbge CreditAttribution: Cvbge commentedYou should not use both '' and NULL to mean "no value" at the same time, unless you want to write
WHERE pages = '' OR pages IS NULL
...So, should it default to NULL or to ''? The patch uses
pages text DEFAULT '' NULL
which is weird and in fact defaults to NULL (tested on 4.1.11).If we assume it's NULL, what about existing entries in the {blocks} table? They use ''. Update function should be written in such case to change them to NULL. Also existing code should be reviewed to check if we need some
IS NULL
orIS NOT NULL
.Maybe it's be better to leave it as it is, i.e. use empty string ('')?
If this have been taken into consideration already, then I'm sorry for being overcautious. Please tell me so and I'll add database.pgsql changes.
Comment #21
drummNone of block.module has special handling for NULL values for pages, to do that would add a lot of code. The default should be what happens if these blocks had been inserted manually, which is an empty string.
Comment #22
Cvbge CreditAttribution: Cvbge commentedLooks ok now. Postgresql does not need any changes in this case.
Comment #23
Dries CreditAttribution: Dries commentedI agree with Moshe that NULL is semantically more correct. Would proper NULL handling add that much extra code?
Comment #24
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedI've committed it. Whether we shoudl use NULL or not should be decided at large and is not part of this issue.
Comment #25
Dries CreditAttribution: Dries commentedWe should use NULL, but yes, it can be fixed later (I guess).
Comment #26
rkerr CreditAttribution: rkerr commentedImporting a fresh 4.6.6 database.mysql, the blocks REPLACE statements still failed for me. Also, two REPLACE statements on the variable table failed as well.
This is my development box at work which happens to be running Windows XP Pro at the moment. I'm running MySQL Server 4.1.16-nt, MySQL Client 5.0.11 using MySQL Administrator's "Restore" feature to import the database.
Re-running the queries as INSERT INTO variable () VALUES() runs without errors.
The blocks failing isn't such a big deal because you can just go and re-enable them. The variables failing is rather important because when you go to "update.php", it will not know where to start doing updates and run everything from the beginning of time which corrupts the database.
Why are the values being REPLACE'd when this is a fresh install of the database?
I have my own opinions about the NULL/NOT NULL but that I think is not central to this issue and is something that should be tackled in Drupal as a whole.
Comment #27
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedthe patch was comitted.
Why was this critical? it apparently only affects people running a beta(?) release of mysql in a particular strict mode.
Comment #28
Cvbge CreditAttribution: Cvbge commentedI'm only curious - but why the REPLACE is failing and INSERT is not?
Comment #29
drummI added the pages column to the insert statement.
Comment #30
(not verified) CreditAttribution: commented