Skip to content

import into: give hint when NULL cannot be parsed due to whitespaces. #83723

@RichardJCai

Description

@RichardJCai

Steps to reproduce:

  1. Make a csv and insert with values
> touch  ~/local/1/data/extern/test.csv
> echo "'adidas', NULL" > ~/local/1/data/extern/test.csv
  1. Import the data from the local csv to the table
> CREATE TABLE test(a string, x bool);
> IMPORT INTO test(a, x) CSV DATA ("nodelocal://1/test.csv") WITH nullif="NULL";

ERROR: nodelocal://1/test.csv: error parsing row 1: parse "x" as BOOL: could not parse "NULL" as type bool: invalid bool value (row: 'adidas', NULL)

The reason is that NULL cannot be parsed due to the whitespace. Adding a hint would make this more obvious and likely save a lot of time.

The solution here would be to specify nullif=' NULL'

Jira issue: CRDB-17225
Epic CRDB-17785

Metadata

Metadata

Assignees

Labels

C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-starterMight be suitable for a starter project for new employees or team members.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions