Project

General

Profile

Actions

Bug #33704

closed

SQL parser does not support NULL as default value

Added by Xavier Perseguers about 12 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Database API (Doctrine DBAL)
Target version:
Start date:
2012-02-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When preparing a database schema with proper referential integrity, one typically has to choose NULL as default value for foreign keys:

CREATE TABLE tx_myext_domain_model_member (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,

    some_fk int(11) DEFAULT NULL,

However, database analyzer does not support NULL as default value and shows an empty string ('') instead, thus suggesting that the underlying table structure is invalid and should be adapted.

Actions #1

Updated by Markus Klein about 12 years ago

I had a look at these things a while ago. I discovered that the MySQL driver for PHP actually doesn't tell you the difference between a default '' and defaul NULL. It always returns '' (with type string).
So I'm not entirely sure, whether we can really fix this.

Actions #2

Updated by Xavier Perseguers about 12 years ago

I have the 3-line fix. I just have to test it with DBAL.

Actions #3

Updated by Gerrit Code Review about 12 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/8861

Actions #4

Updated by Markus Klein about 12 years ago

I had a very similar fix and it didn't work with native mysql access. (I didn't test with DBAL back then.)
I hope yours is working better.

Actions #5

Updated by Xavier Perseguers about 12 years ago

It works fine with native MySQL for me.

Actions #6

Updated by Markus Klein about 12 years ago

Just for the sake of completeness, this was the discussion about default values:
http://lists.typo3.org/pipermail/typo3-english/2011-December/078504.html

And the referenced mysql ticket:
http://bugs.mysql.com/bug.php?id=34198

Actions #7

Updated by Gerrit Code Review about 12 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/8879

Actions #8

Updated by Xavier Perseguers about 12 years ago

  • Status changed from Under Review to Resolved
  • Target version set to 4.6.5
  • % Done changed from 0 to 100
Actions #9

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF