Bug #13214

Importing a CSV with '--skip-nested-set-build' raises an error in 2.5.x

Added by Steve Breker 3 months ago.

Status:NewStart date:11/19/2019
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Data model / ORM
Target version:Release 2.6.0
Google Code Legacy ID: Tested version:2.5
Sponsored:No Requires documentation:

Description

To reproduce:

- Run the `csv:import` CLI task with the `--skip-nested-set-build` option set.

Notes:

The LFT and RGT columns will trigger the error:

Unable to execute INSERT statement. [wrapped: SQLSTATE[HY000]: General error: 1364 Field 'lft' doesn't have a default value]

On a 16.04 system, or with STRICT_TRANS_TABLES off, the import will proceed normally and the LFT and RGT fields will be set with a value of 0.
If the database is changed so that NULL is allowed in this field, a further Propel error is generated implying there is an assumption in the code that the default value needs to be zero and not NULL:

wrapped: Could not build SQL for expression: information_object.LFT < NULL

This issue is triggered by the re-addition of STRICT_TRANS_TABLES to the sql_mode. Options to fix it:

1. Remove the NOT NULL clause or add a default value to the column (requires migration). See notes above regarding default value.
2. Remove STRICT_TRANS_TABLES from sql_mode (less secure database and requires documentation and deploy changes).
3. Make sure LFT and RGT are not NULL on save of hierarchical objects. This could be limited to those objects that can be imported via CSV with a 'skip-nested-set' option, but it would be best to fix any other affected tables.


Related issues

Related to Access to Memory (AtoM) - Bug #13144: Creating a digital object without path raises an error in... Verified 08/12/2019

History

#1 Updated by Steve Breker 3 months ago

  • Related to Bug #13144: Creating a digital object without path raises an error in 2.5.x added

Also available in: Atom PDF