Skip to content

Remove MDB2_PORTABILITY_EMPTY_TO_NULL from MDB2 options; fixes issue #2371 - #2389

Closed
sodnpoo wants to merge 1 commit into
owncloud:masterfrom
sodnpoo:master
Closed

sodnpoo wants to merge 1 commit into
owncloud:masterfrom
sodnpoo:master

Conversation

@sodnpoo

@sodnpoo sodnpoo commented Mar 17, 2013

Copy link
Copy Markdown

Remove MDB2_PORTABILITY_EMPTY_TO_NULL from MDB2 options; fixes issue #2371

Remove MDB2_PORTABILITY_EMPTY_TO_NULL from MDB2 options; fixes issue owncloud#2371
@karlitschek

Copy link
Copy Markdown
Contributor

Can't test: @eMerzh @Raydiation @bartv2 @icewind1991 @butonic

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@sodnpoo Please state that ouy license this under MIT license - or you can sign the contributors agreement - @karlitschek

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@owncloud-bot retest this please

@karlitschek

Copy link
Copy Markdown
Contributor

@DeepDiver1975 Good point. A one line is normally ok but still would be good.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@sodnpoo Can I ask you to implement a small and simple unit test? Would help a lot to get the problem sorted out on all databases. THX

@eMerzh

eMerzh commented Mar 17, 2013

Copy link
Copy Markdown
Contributor

for what i've tested it's ok for me ... and it's usally a good idea to have this so i'm in favor of merging...

but i'm also behind @DeepDiver1975 it would be great to have some small unit test :)

@sodnpoo

sodnpoo commented Mar 19, 2013

Copy link
Copy Markdown
Author

@DeepDiver1975 how do I go about signing the contributors agreement?

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

👎
MDB2_PORTABILITY_EMPTY_TO_NULL makes all dbs behave like oracle (yes, broken). Removing MDB2_PORTABILITY_EMPTY_TO_NULL will only make empty as null issues harder to find for oracle. Instead we could remove the notnull constraint from the columns in question: oc_filecache.path (#2371, #3298) #2385 sems to be a bug somewhere else, or why would someone store an empty mimetype. If that is intended behavior removing the notnull constraint would work there, too.

@DeepDiver1975 why exactly did you disable the portability for MSSQL in the first place?

@butonic butonic mentioned this pull request May 13, 2013
@DeepDiver1975

Copy link
Copy Markdown
Contributor

@DeepDiver1975 why exactly did you disable the portability for MSSQL in the first place?

mssql is broken as well - just like Oracle ???

Queries/unit tests which execute fine on other dbs failed with mssql.
Disabling this feature made them pass.

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

AFAIK mssql knows the difference between '' and NULL and stores them just fine. hm mdb2 will also convert null to emptystring in return values I think. maybe thats what makes it work in mssql? we need more debug output when the database queries fail ...

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

for those to lazy to read the docs:

MDB2_PORTABILITY_EMPTY_TO_NULL

Convert empty strings values to null in data in and output. Needed because Oracle considers empty strings to be null, while most other DBMSs know the difference between empty and null.

@DeepDiver1975

Copy link
Copy Markdown
Contributor

AFAIK mssql knows the difference between '' and NULL

yes - and this causes the failure as mdb2 converts empty strings to null.
Having a not null string column will break if you try to insert NULL instead of ''

Having MDB2_PORTABILITY_EMPTY_TO_NULL disabled -> works

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

removing the not null constraint works just as well. even on oracle. so either loose portability or drop the notnull constraint
@karlitschek your call

@DeepDiver1975

Copy link
Copy Markdown
Contributor

so either loose portability or drop the notnull constraint

Hmm - looks like I don't see the issue.
What's the problem with disabling the necessary options depending on the databases we are connected to?
Actually the way I did with MSSQL?

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

The problem is that disabling MDB2_PORTABILITY_EMPTY_TO_NULL does not teach oracle the difference between '' and NULL. We would get rid of the issues, yes. Leaving this portability flag enabled will force use to take care of related problems in a way that solves them for oracle as well. I'll try to make this a list:

MDB2_PORTABILITY_EMPTY_TO_NULL enabled:

  • columns that might need to store '' must be defined without notnull constraint to make them work in any db
  • this is exactly what a dbal is meant to do for us, treat all dbms equal

MDB2_PORTABILITY_EMPTY_TO_NULL disabled:

  • columns that might need to store '' must be defined without notnull constraint to make them work in oracle
  • databases that know the difference between '' and NULL will 'just work' although mssql seems to still have problems

-> issues related to '' vs NULL will only surface when testing on oracle. Automating that is far from done and it seems I am the only one testing that db. Disabling MDB2_PORTABILITY_EMPTY_TO_NULL will reducing the chances of finding these issues. And I don't want them to surface at large installations running oracle.

The mentioned github issues can all be solved by allowing null values in string columns, which fixes the problem in a database portable way.

Disabling db portability features is not a way to solve bugs IMHO.

@butonic

butonic commented May 13, 2013

Copy link
Copy Markdown
Contributor

@bartv2 whats the null vs '' situation for oracle with doctrine?

@bartv2

bartv2 commented Jun 29, 2013

Copy link
Copy Markdown
Contributor

closed as mentioned in #3666

@bartv2 bartv2 closed this Jun 29, 2013
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants