1

I am trying to insert a list of values to a column INTEGER[]. For that I am creating list value as I need to use appender. But duckdb_create_list_value is always returning NULL. I am using v 1.4.1 C API. This is simplified version of my code

// Create a logical type for a list of integers
duckdb_logical_type int_type = duckdb_create_logical_type(DUCKDB_TYPE_INTEGER);
duckdb_logical_type list_type = duckdb_create_list_type(int_type);

// Create individual integer values for the list elements
duckdb_value val1 = duckdb_create_int32(10);
duckdb_value val2 = duckdb_create_int32(20);
duckdb_value val3 = duckdb_create_int32(30);

// Put values into an array
duckdb_value values[] = {val1, val2, val3};

// Create the list value
duckdb_value list_value = duckdb_create_list_value(list_type, values, 3);
//list_value is NULL

1 Answer 1

1

Confusingly, the first argument to duckdb_create_list_value should be the type of the values in the list, not the type of the list itself. So, in your example, you would pass int_type, not list_type.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.