clickhouse icon indicating copy to clipboard operation
clickhouse copied to clipboard

Inserting empty string to String type field cause error.

Open VVVi opened this issue 3 years ago • 1 comments

Inserting empty string to String type field cause error, when the empty field is the last in insert: INSERT INTO test_array (date, arr, arr2, arr3, str)'. The example is below. Thanks.

               clickhouse.sessionId = Date.now();
		
		const r = await clickhouse.query(`
			CREATE TABLE IF NOT EXISTS test_array (
				date Date,
				str String,
				arr Array(String),
				arr2 Array(Date),
				arr3 Array(UInt8)
			) ENGINE=MergeTree(date, date, 8192)
		`).toPromise();
		expect(r).to.be.ok();
		
		const rows = [
			{
				date: '2018-01-01',
				str: '',
				arr: [],
				arr2: ['1915-01-02', '1915-01-03'],
				arr3: [1,2,3,4,5]
			}
		];
		
		const r2 = await clickhouse.insert(
			'INSERT INTO test_array (date, arr, arr2, arr3, str)',
			rows
		).toPromise();
		expect(r2).to.be.ok();

VVVi avatar Nov 17 '21 18:11 VVVi

Hi, could you please post error text, nodejs and ClickHouse versions

TimonKK avatar Nov 30 '21 21:11 TimonKK