SQLPro
SQLPro copied to clipboard
String field "NULL" is interpreted as NULL instead of as a string
Describe the bug Import of a CSV file with one of the fields containing a word "null" imports a NULL value instead of the string value "null". NULL without double-quote qualifiers is correctly interpreted as NULL value. But when inside double-quotes, the value should be interpreted as a non-null string value.
To Reproduce
- Create a table:
CREATE TABLE IF NOT EXISTS "words" ( word varchar(64) COLLATE NOCASE NOT NULL, context varchar(64) COLLATE NOCASE, PRIMARY KEY(word) );
- Create a CSV file with content:
"Word","Context" "nuisance",NULL "null",1,NULL "nullify","some context"
-
Import into the created table, select the file, "1st row contains headers" on
-
The import fails due to NOT NULL constraint violation, because the word "null" in the second row is interpreted as a value instead of as a string.
Expected behavior The value of the column 'word' in the 2nd row should be "null", not NULL, after import.
Environment details:
- Device: MacBook Pro
- OS: Sequoia 15.2 (24C101)
- SQLPro app Version : SQLPro for SQLite Version 2024.79 (Build 4379.5)
- Installation source: App Store
- Target database server: Sqlite
I'll take a look into this. Should be able to have it sorted up for next week.
Latest SQLPro for SQLite build (2025.01) should be available on the App Store and it should sort this out. You shouldn't need to do anything differently. SQLPro should already know the column is
If you get the chance, please give it a try and let me know if that sorts things out for you.
Thanks for looking into this. It's been fixed, although it capitalises the word for some reason as seen in the images below (grey - csv file, blue - data after import).
I also noticed editing data in the table editor is wonky for the record with PK value (string)"null"(possibly also for other constraints). Specifically, if I edit any other fields in that record (or even if I change PK field value to say "NULL1") and click "apply", all my changes in the row get discarded without any message or warning. Other records can be edited alright.
I also noticed editing data in the table editor is wonky for the record with PK value (string)"null"(possibly also for other constraints). Specifically, if I edit any other fields in that record (or even if I change PK field value to say "NULL1") and click "apply", all my changes in the row get discarded without any message or warning. Other records can be edited alright.
Fixed for the next build which should be available sometime this week.
Thanks for looking into this. It's been fixed, although it capitalises the word for some reason as seen in the images below (grey - csv file, blue - data after import).
Reproduced but still investigating. I know where any why it happens, I just want to make sure I don't break anything with null imports with others as I'm fixing. May or may not make into the next build.
I also noticed editing data in the table editor is wonky for the record with PK value (string)"null"(possibly also for other constraints). Specifically, if I edit any other fields in that record (or even if I change PK field value to say "NULL1") and click "apply", all my changes in the row get discarded without any message or warning. Other records can be edited alright.
The latest Mac app store build (2025.02) should resolve this, as well as the website build https://sqlprostudio.s3.us-east-1.amazonaws.com/sqlite/SQLProSQLite.2025.05.app.zip.
Still figure out the best choice code wise for the secondary item.