⌘K ctrl+k
Search Shortcut cmd + k | ctrl + k

Values

The value class represents a single value of any type.

API Reference Overview

void duckdb_destroy_value(duckdb_value *value);
duckdb_value duckdb_create_varchar(const char *text);
duckdb_value duckdb_create_varchar_length(const char *text, idx_t length);
duckdb_value duckdb_create_bool(bool input);
duckdb_value duckdb_create_int8(int8_t input);
duckdb_value duckdb_create_uint8(uint8_t input);
duckdb_value duckdb_create_int16(int16_t input);
duckdb_value duckdb_create_uint16(uint16_t input);
duckdb_value duckdb_create_int32(int32_t input);
duckdb_value duckdb_create_uint32(uint32_t input);
duckdb_value duckdb_create_uint64(uint64_t input);
duckdb_value duckdb_create_int64(int64_t val);
duckdb_value duckdb_create_hugeint(duckdb_hugeint input);
duckdb_value duckdb_create_uhugeint(duckdb_uhugeint input);
duckdb_value duckdb_create_bignum(duckdb_bignum input);
duckdb_value duckdb_create_decimal(duckdb_decimal input);
duckdb_value duckdb_create_float(float input);
duckdb_value duckdb_create_double(double input);
duckdb_value duckdb_create_date(duckdb_date input);
duckdb_value duckdb_create_time(duckdb_time input);
duckdb_value duckdb_create_time_ns(duckdb_time_ns input);
duckdb_value duckdb_create_time_tz_value(duckdb_time_tz value);
duckdb_value duckdb_create_timestamp(duckdb_timestamp input);
duckdb_value duckdb_create_timestamp_tz(duckdb_timestamp input);
duckdb_value duckdb_create_timestamp_tz_ns(duckdb_timestamp_ns input);
duckdb_value duckdb_create_timestamp_s(duckdb_timestamp_s input);
duckdb_value duckdb_create_timestamp_ms(duckdb_timestamp_ms input);
duckdb_value duckdb_create_timestamp_ns(duckdb_timestamp_ns input);
duckdb_value duckdb_create_interval(duckdb_interval input);
duckdb_value duckdb_create_blob(const uint8_t *data, idx_t length);
duckdb_value duckdb_create_bit(duckdb_bit input);
duckdb_value duckdb_create_uuid(duckdb_uhugeint input);
bool duckdb_get_bool(duckdb_value val);
int8_t duckdb_get_int8(duckdb_value val);
uint8_t duckdb_get_uint8(duckdb_value val);
int16_t duckdb_get_int16(duckdb_value val);
uint16_t duckdb_get_uint16(duckdb_value val);
int32_t duckdb_get_int32(duckdb_value val);
uint32_t duckdb_get_uint32(duckdb_value val);
int64_t duckdb_get_int64(duckdb_value val);
uint64_t duckdb_get_uint64(duckdb_value val);
duckdb_hugeint duckdb_get_hugeint(duckdb_value val);
duckdb_uhugeint duckdb_get_uhugeint(duckdb_value val);
duckdb_bignum duckdb_get_bignum(duckdb_value val);
duckdb_decimal duckdb_get_decimal(duckdb_value val);
float duckdb_get_float(duckdb_value val);
double duckdb_get_double(duckdb_value val);
duckdb_date duckdb_get_date(duckdb_value val);
duckdb_time duckdb_get_time(duckdb_value val);
duckdb_time_ns duckdb_get_time_ns(duckdb_value val);
duckdb_time_tz duckdb_get_time_tz(duckdb_value val);
duckdb_timestamp duckdb_get_timestamp(duckdb_value val);
duckdb_timestamp duckdb_get_timestamp_tz(duckdb_value val);
duckdb_timestamp_ns duckdb_get_timestamp_tz_ns(duckdb_value val);
duckdb_timestamp_s duckdb_get_timestamp_s(duckdb_value val);
duckdb_timestamp_ms duckdb_get_timestamp_ms(duckdb_value val);
duckdb_timestamp_ns duckdb_get_timestamp_ns(duckdb_value val);
duckdb_interval duckdb_get_interval(duckdb_value val);
duckdb_logical_type duckdb_get_value_type(duckdb_value val);
duckdb_blob duckdb_get_blob(duckdb_value val);
duckdb_bit duckdb_get_bit(duckdb_value val);
duckdb_uhugeint duckdb_get_uuid(duckdb_value val);
char *duckdb_get_varchar(duckdb_value value);
duckdb_value duckdb_create_struct_value(duckdb_logical_type type, duckdb_value *values);
duckdb_value duckdb_create_list_value(duckdb_logical_type type, duckdb_value *values, idx_t value_count);
duckdb_value duckdb_create_array_value(duckdb_logical_type type, duckdb_value *values, idx_t value_count);
duckdb_value duckdb_create_map_value(duckdb_logical_type map_type, duckdb_value *keys, duckdb_value *values, idx_t entry_count);
duckdb_value duckdb_create_union_value(duckdb_logical_type union_type, idx_t tag_index, duckdb_value value);
idx_t duckdb_get_map_size(duckdb_value value);
duckdb_value duckdb_get_map_key(duckdb_value value, idx_t index);
duckdb_value duckdb_get_map_value(duckdb_value value, idx_t index);
bool duckdb_is_null_value(duckdb_value value);
duckdb_value duckdb_create_null_value(void);
idx_t duckdb_get_list_size(duckdb_value value);
duckdb_value duckdb_get_list_child(duckdb_value value, idx_t index);
duckdb_value duckdb_create_enum_value(duckdb_logical_type type, uint64_t value);
uint64_t duckdb_get_enum_value(duckdb_value value);
duckdb_value duckdb_get_struct_child(duckdb_value value, idx_t index);
char *duckdb_value_to_string(duckdb_value value);
bool duckdb_value_boolean(duckdb_result *result, idx_t col, idx_t row);
int8_t duckdb_value_int8(duckdb_result *result, idx_t col, idx_t row);
int16_t duckdb_value_int16(duckdb_result *result, idx_t col, idx_t row);
int32_t duckdb_value_int32(duckdb_result *result, idx_t col, idx_t row);
int64_t duckdb_value_int64(duckdb_result *result, idx_t col, idx_t row);
duckdb_hugeint duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row);
duckdb_uhugeint duckdb_value_uhugeint(duckdb_result *result, idx_t col, idx_t row);
duckdb_decimal duckdb_value_decimal(duckdb_result *result, idx_t col, idx_t row);
uint8_t duckdb_value_uint8(duckdb_result *result, idx_t col, idx_t row);
uint16_t duckdb_value_uint16(duckdb_result *result, idx_t col, idx_t row);
uint32_t duckdb_value_uint32(duckdb_result *result, idx_t col, idx_t row);
uint64_t duckdb_value_uint64(duckdb_result *result, idx_t col, idx_t row);
float duckdb_value_float(duckdb_result *result, idx_t col, idx_t row);
double duckdb_value_double(duckdb_result *result, idx_t col, idx_t row);
duckdb_date duckdb_value_date(duckdb_result *result, idx_t col, idx_t row);
duckdb_time duckdb_value_time(duckdb_result *result, idx_t col, idx_t row);
duckdb_timestamp duckdb_value_timestamp(duckdb_result *result, idx_t col, idx_t row);
duckdb_interval duckdb_value_interval(duckdb_result *result, idx_t col, idx_t row);
char *duckdb_value_varchar(duckdb_result *result, idx_t col, idx_t row);
duckdb_string duckdb_value_string(duckdb_result *result, idx_t col, idx_t row);
char *duckdb_value_varchar_internal(duckdb_result *result, idx_t col, idx_t row);
duckdb_string duckdb_value_string_internal(duckdb_result *result, idx_t col, idx_t row);
duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row);
bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row);

duckdb_destroy_value

Stable since 0.3.3.

Destroys the value and de-allocates all memory allocated for that type.

Syntax
void duckdb_destroy_value(
  duckdb_value *value
);
Parameters
  • value: The value to destroy.


duckdb_create_varchar

Stable since 0.3.3.

Creates a value from a null-terminated string. Returns nullptr if the string is not valid UTF-8 or other invalid input.

Superseded by duckdb_create_varchar_length.

Syntax
duckdb_value duckdb_create_varchar(
  const char *text
);
Parameters
  • text: The null-terminated string
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_varchar_length

Stable since 0.3.3.

Creates a value from a string. Returns nullptr if the string is not valid UTF-8 or other invalid input.

Syntax
duckdb_value duckdb_create_varchar_length(
  const char *text,
  idx_t length
);
Parameters
  • text: The text
  • length: The length of the text
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_bool

Stable since 1.1.0.

Creates a value from a boolean

Syntax
duckdb_value duckdb_create_bool(
  bool input
);
Parameters
  • input: The boolean value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_int8

Stable since 1.1.0.

Creates a value from an int8_t (a tinyint)

Syntax
duckdb_value duckdb_create_int8(
  int8_t input
);
Parameters
  • input: The tinyint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uint8

Stable since 1.1.0.

Creates a value from a uint8_t (a utinyint)

Syntax
duckdb_value duckdb_create_uint8(
  uint8_t input
);
Parameters
  • input: The utinyint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_int16

Stable since 1.1.0.

Creates a value from an int16_t (a smallint)

Syntax
duckdb_value duckdb_create_int16(
  int16_t input
);
Parameters
  • input: The smallint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uint16

Stable since 1.1.0.

Creates a value from a uint16_t (a usmallint)

Syntax
duckdb_value duckdb_create_uint16(
  uint16_t input
);
Parameters
  • input: The usmallint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_int32

Stable since 1.1.0.

Creates a value from an int32_t (an integer)

Syntax
duckdb_value duckdb_create_int32(
  int32_t input
);
Parameters
  • input: The integer value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uint32

Stable since 1.1.0.

Creates a value from a uint32_t (a uinteger)

Syntax
duckdb_value duckdb_create_uint32(
  uint32_t input
);
Parameters
  • input: The uinteger value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uint64

Stable since 1.1.0.

Creates a value from a uint64_t (a ubigint)

Syntax
duckdb_value duckdb_create_uint64(
  uint64_t input
);
Parameters
  • input: The ubigint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_int64

Stable since 0.3.3.

Creates a value from an int64

Syntax
duckdb_value duckdb_create_int64(
  int64_t val
);
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_hugeint

Stable since 1.1.0.

Creates a value from a hugeint

Syntax
duckdb_value duckdb_create_hugeint(
  duckdb_hugeint input
);
Parameters
  • input: The hugeint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uhugeint

Stable since 1.1.0.

Creates a value from a uhugeint

Syntax
duckdb_value duckdb_create_uhugeint(
  duckdb_uhugeint input
);
Parameters
  • input: The uhugeint value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_bignum

Stable since 1.2.0. Renamed from duckdb_create_varint in 1.4.0.

Creates a BIGNUM value from a duckdb_bignum

Syntax
duckdb_value duckdb_create_bignum(
  duckdb_bignum input
);
Parameters
  • input: The duckdb_bignum value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_decimal

Stable since 1.2.0.

Creates a DECIMAL value from a duckdb_decimal

Syntax
duckdb_value duckdb_create_decimal(
  duckdb_decimal input
);
Parameters
  • input: The duckdb_decimal value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_float

Stable since 1.1.0.

Creates a value from a float

Syntax
duckdb_value duckdb_create_float(
  float input
);
Parameters
  • input: The float value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_double

Stable since 1.1.0.

Creates a value from a double

Syntax
duckdb_value duckdb_create_double(
  double input
);
Parameters
  • input: The double value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_date

Stable since 1.1.0.

Creates a value from a date

Syntax
duckdb_value duckdb_create_date(
  duckdb_date input
);
Parameters
  • input: The date value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_time

Stable since 1.1.0.

Creates a value from a time

Syntax
duckdb_value duckdb_create_time(
  duckdb_time input
);
Parameters
  • input: The time value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_time_ns

Stable since 1.5.6.

Creates a value from a time_ns

Syntax
duckdb_value duckdb_create_time_ns(
  duckdb_time_ns input
);
Parameters
  • input: The time value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_time_tz_value

Stable since 1.1.0.

Creates a value from a time_tz. Not to be confused with duckdb_create_time_tz, which creates a duckdb_time_tz_t.

Syntax
duckdb_value duckdb_create_time_tz_value(
  duckdb_time_tz value
);
Parameters
  • value: The time_tz value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp

Stable since 1.1.0.

Creates a TIMESTAMP value from a duckdb_timestamp

Syntax
duckdb_value duckdb_create_timestamp(
  duckdb_timestamp input
);
Parameters
  • input: The duckdb_timestamp value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp_tz

Stable since 1.2.0.

Creates a TIMESTAMP_TZ value from a duckdb_timestamp

Syntax
duckdb_value duckdb_create_timestamp_tz(
  duckdb_timestamp input
);
Parameters
  • input: The duckdb_timestamp value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp_tz_ns

Stable since 1.5.6.

Creates a TIMESTAMP_TZ_NS value from a duckdb_timestamp_ns

Syntax
duckdb_value duckdb_create_timestamp_tz_ns(
  duckdb_timestamp_ns input
);
Parameters
  • input: The duckdb_timestamp_ns value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp_s

Stable since 1.2.0.

Creates a TIMESTAMP_S value from a duckdb_timestamp_s

Syntax
duckdb_value duckdb_create_timestamp_s(
  duckdb_timestamp_s input
);
Parameters
  • input: The duckdb_timestamp_s value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp_ms

Stable since 1.2.0.

Creates a TIMESTAMP_MS value from a duckdb_timestamp_ms

Syntax
duckdb_value duckdb_create_timestamp_ms(
  duckdb_timestamp_ms input
);
Parameters
  • input: The duckdb_timestamp_ms value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_timestamp_ns

Stable since 1.2.0.

Creates a TIMESTAMP_NS value from a duckdb_timestamp_ns

Syntax
duckdb_value duckdb_create_timestamp_ns(
  duckdb_timestamp_ns input
);
Parameters
  • input: The duckdb_timestamp_ns value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_interval

Stable since 1.1.0.

Creates a value from an interval

Syntax
duckdb_value duckdb_create_interval(
  duckdb_interval input
);
Parameters
  • input: The interval value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_blob

Stable since 1.1.0.

Creates a value from a blob

Syntax
duckdb_value duckdb_create_blob(
  const uint8_t *data,
  idx_t length
);
Parameters
  • data: The blob data
  • length: The length of the blob data
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_bit

Stable since 1.2.0.

Creates a BIT value from a duckdb_bit

Syntax
duckdb_value duckdb_create_bit(
  duckdb_bit input
);
Parameters
  • input: The duckdb_bit value
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_create_uuid

Stable since 1.2.0.

Creates a UUID value from a uhugeint

Syntax
duckdb_value duckdb_create_uuid(
  duckdb_uhugeint input
);
Parameters
  • input: The duckdb_uhugeint containing the UUID
Return Value

The value. This must be destroyed with duckdb_destroy_value.


duckdb_get_bool

Stable since 1.1.0.

Returns the boolean value of the given value.

Syntax
bool duckdb_get_bool(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a boolean
Return Value

A boolean, or false if the value cannot be converted


duckdb_get_int8

Stable since 1.1.0.

Returns the int8_t value of the given value.

Syntax
int8_t duckdb_get_int8(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a tinyint
Return Value

A int8_t, or MinValue<int8> if the value cannot be converted


duckdb_get_uint8

Stable since 1.1.0.

Returns the uint8_t value of the given value.

Syntax
uint8_t duckdb_get_uint8(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a utinyint
Return Value

A uint8_t, or MinValue<uint8> if the value cannot be converted


duckdb_get_int16

Stable since 1.1.0.

Returns the int16_t value of the given value.

Syntax
int16_t duckdb_get_int16(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a smallint
Return Value

A int16_t, or MinValue<int16> if the value cannot be converted


duckdb_get_uint16

Stable since 1.1.0.

Returns the uint16_t value of the given value.

Syntax
uint16_t duckdb_get_uint16(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a usmallint
Return Value

A uint16_t, or MinValue<uint16> if the value cannot be converted


duckdb_get_int32

Stable since 1.1.0.

Returns the int32_t value of the given value.

Syntax
int32_t duckdb_get_int32(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing an integer
Return Value

A int32_t, or MinValue<int32> if the value cannot be converted


duckdb_get_uint32

Stable since 1.1.0.

Returns the uint32_t value of the given value.

Syntax
uint32_t duckdb_get_uint32(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a uinteger
Return Value

A uint32_t, or MinValue<uint32> if the value cannot be converted


duckdb_get_int64

Stable since 0.3.3.

Returns the int64_t value of the given value.

Syntax
int64_t duckdb_get_int64(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a bigint
Return Value

A int64_t, or MinValue<int64> if the value cannot be converted


duckdb_get_uint64

Stable since 1.1.0.

Returns the uint64_t value of the given value.

Syntax
uint64_t duckdb_get_uint64(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a ubigint
Return Value

A uint64_t, or MinValue<uint64> if the value cannot be converted


duckdb_get_hugeint

Stable since 1.1.0.

Returns the hugeint value of the given value.

Syntax
duckdb_hugeint duckdb_get_hugeint(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a hugeint
Return Value

A duckdb_hugeint, or MinValue<hugeint> if the value cannot be converted


duckdb_get_uhugeint

Stable since 1.1.0.

Returns the uhugeint value of the given value.

Syntax
duckdb_uhugeint duckdb_get_uhugeint(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a uhugeint
Return Value

A duckdb_uhugeint, or MinValue<uhugeint> if the value cannot be converted


duckdb_get_bignum

Stable since 1.2.0. Renamed from duckdb_get_varint in 1.4.0.

Returns the duckdb_bignum value of the given value. The data field must be destroyed with duckdb_free.

Syntax
duckdb_bignum duckdb_get_bignum(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a BIGNUM
Return Value

A duckdb_bignum. The data field must be destroyed with duckdb_free.


duckdb_get_decimal

Stable since 1.2.0.

Returns the duckdb_decimal value of the given value.

Syntax
duckdb_decimal duckdb_get_decimal(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a DECIMAL
Return Value

A duckdb_decimal, or MinValue<decimal> if the value cannot be converted


duckdb_get_float

Stable since 1.1.0.

Returns the float value of the given value.

Syntax
float duckdb_get_float(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a float
Return Value

A float, or NAN if the value cannot be converted


duckdb_get_double

Stable since 1.1.0.

Returns the double value of the given value.

Syntax
double duckdb_get_double(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a double
Return Value

A double, or NAN if the value cannot be converted


duckdb_get_date

Stable since 1.1.0.

Returns the date value of the given value.

Syntax
duckdb_date duckdb_get_date(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a date
Return Value

A duckdb_date, or MinValue<date> if the value cannot be converted


duckdb_get_time

Stable since 1.1.0.

Returns the time value of the given value.

Syntax
duckdb_time duckdb_get_time(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a time
Return Value

A duckdb_time, or MinValue<time> if the value cannot be converted


duckdb_get_time_ns

Stable since 1.5.6.

Returns the time_ns value of the given value.

Syntax
duckdb_time_ns duckdb_get_time_ns(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a time_ns
Return Value

A duckdb_time_ns, or MinValue<time_ns> if the value cannot be converted


duckdb_get_time_tz

Stable since 1.1.0.

Returns the time_tz value of the given value.

Syntax
duckdb_time_tz duckdb_get_time_tz(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a time_tz
Return Value

A duckdb_time_tz, or MinValue<time_tz> if the value cannot be converted


duckdb_get_timestamp

Stable since 1.1.0.

Returns the TIMESTAMP value of the given value.

Syntax
duckdb_timestamp duckdb_get_timestamp(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP
Return Value

A duckdb_timestamp, or MinValue<timestamp> if the value cannot be converted


duckdb_get_timestamp_tz

Stable since 1.2.0.

Returns the TIMESTAMP_TZ value of the given value.

Syntax
duckdb_timestamp duckdb_get_timestamp_tz(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP_TZ
Return Value

A duckdb_timestamp, or MinValue<timestamp_tz> if the value cannot be converted


duckdb_get_timestamp_tz_ns

Stable since 1.5.6.

Returns the TIMESTAMP_TZ_NS value of the given value.

Syntax
duckdb_timestamp_ns duckdb_get_timestamp_tz_ns(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP_TZ_NS
Return Value

A duckdb_timestamp_ns, or MinValue<timestamp_tz_ns> if the value cannot be converted


duckdb_get_timestamp_s

Stable since 1.2.0.

Returns the duckdb_timestamp_s value of the given value.

Syntax
duckdb_timestamp_s duckdb_get_timestamp_s(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP_S
Return Value

A duckdb_timestamp_s, or MinValue<timestamp_s> if the value cannot be converted


duckdb_get_timestamp_ms

Stable since 1.2.0.

Returns the duckdb_timestamp_ms value of the given value.

Syntax
duckdb_timestamp_ms duckdb_get_timestamp_ms(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP_MS
Return Value

A duckdb_timestamp_ms, or MinValue<timestamp_ms> if the value cannot be converted


duckdb_get_timestamp_ns

Stable since 1.2.0.

Returns the duckdb_timestamp_ns value of the given value.

Syntax
duckdb_timestamp_ns duckdb_get_timestamp_ns(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a TIMESTAMP_NS
Return Value

A duckdb_timestamp_ns, or MinValue<timestamp_ns> if the value cannot be converted


duckdb_get_interval

Stable since 1.1.0.

Returns the interval value of the given value.

Syntax
duckdb_interval duckdb_get_interval(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a interval
Return Value

A duckdb_interval, or MinValue<interval> if the value cannot be converted


duckdb_get_value_type

Stable since 1.1.0.

Returns the type of the given value. The type is valid as long as the value is not destroyed. The type itself must not be destroyed.

Syntax
duckdb_logical_type duckdb_get_value_type(
  duckdb_value val
);
Parameters
  • val: A duckdb_value
Return Value

A duckdb_logical_type.


duckdb_get_blob

Stable since 1.1.0.

Returns the blob value of the given value.

Syntax
duckdb_blob duckdb_get_blob(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a blob
Return Value

A duckdb_blob


duckdb_get_bit

Stable since 1.2.0.

Returns the duckdb_bit value of the given value. The data field must be destroyed with duckdb_free.

Syntax
duckdb_bit duckdb_get_bit(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a BIT
Return Value

A duckdb_bit


duckdb_get_uuid

Stable since 1.2.0.

Returns a duckdb_uhugeint representing the UUID value of the given value.

Syntax
duckdb_uhugeint duckdb_get_uuid(
  duckdb_value val
);
Parameters
  • val: A duckdb_value containing a UUID
Return Value

A duckdb_uhugeint representing the UUID value


duckdb_get_varchar

Stable since 0.3.3.

Obtains a string representation of the given value. The result must be destroyed with duckdb_free.

Syntax
char *duckdb_get_varchar(
  duckdb_value value
);
Parameters
  • value: The value
Return Value

The string value. This must be destroyed with duckdb_free.


duckdb_create_struct_value

Stable since 0.10.0.

Creates a struct value from a type and an array of values. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_struct_value(
  duckdb_logical_type type,
  duckdb_value *values
);
Parameters
  • type: The type of the struct
  • values: The values for the struct fields
Return Value

The struct value, or nullptr, if any child type is DUCKDB_TYPE_ANY or DUCKDB_TYPE_INVALID.


duckdb_create_list_value

Stable since 0.10.0.

Creates a list value from a child (element) type and an array of values of length value_count. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_list_value(
  duckdb_logical_type type,
  duckdb_value *values,
  idx_t value_count
);
Parameters
  • type: The type of the list
  • values: The values for the list
  • value_count: The number of values in the list
Return Value

The list value, or nullptr, if the child type is DUCKDB_TYPE_ANY or DUCKDB_TYPE_INVALID.


duckdb_create_array_value

Stable since 0.10.1.

Creates an array value from a child (element) type and an array of values of length value_count. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_array_value(
  duckdb_logical_type type,
  duckdb_value *values,
  idx_t value_count
);
Parameters
  • type: The type of the array
  • values: The values for the array
  • value_count: The number of values in the array
Return Value

The array value, or nullptr, if the child type is DUCKDB_TYPE_ANY or DUCKDB_TYPE_INVALID.


duckdb_create_map_value

Stable since 1.5.6.

Creates a map value from a map type and two arrays, one for the keys and one for the values, each of length entry_count. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_map_value(
  duckdb_logical_type map_type,
  duckdb_value *keys,
  duckdb_value *values,
  idx_t entry_count
);
Parameters
  • map_type: The map type
  • keys: The keys of the map
  • values: The values of the map
  • entry_count: The number of entries (key-value pairs) in the map
Return Value

The map value, or nullptr, if the parameters are invalid.


duckdb_create_union_value

Stable since 1.5.6.

Creates a union value from a union type, a tag index, and a value. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_union_value(
  duckdb_logical_type union_type,
  idx_t tag_index,
  duckdb_value value
);
Parameters
  • union_type: The union type
  • tag_index: The index of the tag of the union
  • value: The value of the union for that tag
Return Value

The union value, or nullptr, if the parameters are invalid.


duckdb_get_map_size

Stable since 1.1.0.

Returns the number of elements in a MAP value.

Syntax
idx_t duckdb_get_map_size(
  duckdb_value value
);
Parameters
  • value: The MAP value.
Return Value

The number of elements in the map.


duckdb_get_map_key

Stable since 1.1.0.

Returns the MAP key at index as a duckdb_value.

Syntax
duckdb_value duckdb_get_map_key(
  duckdb_value value,
  idx_t index
);
Parameters
  • value: The MAP value.
  • index: The index of the key.
Return Value

The key as a duckdb_value.


duckdb_get_map_value

Stable since 1.1.0.

Returns the MAP value at index as a duckdb_value.

Syntax
duckdb_value duckdb_get_map_value(
  duckdb_value value,
  idx_t index
);
Parameters
  • value: The MAP value.
  • index: The index of the value.
Return Value

The value as a duckdb_value.


duckdb_is_null_value

Stable since 1.2.0.

Returns whether the value's type is SQLNULL or not.

Syntax
bool duckdb_is_null_value(
  duckdb_value value
);
Parameters
  • value: The value to check.
Return Value

True, if the value's type is SQLNULL, otherwise false.


duckdb_create_null_value

Stable since 1.2.0.

Creates a value of type SQLNULL.

Syntax
duckdb_value duckdb_create_null_value(void);
Return Value

The duckdb_value representing SQLNULL. This must be destroyed with duckdb_destroy_value.


duckdb_get_list_size

Stable since 1.2.0.

Returns the number of elements in a LIST value.

Syntax
idx_t duckdb_get_list_size(
  duckdb_value value
);
Parameters
  • value: The LIST value.
Return Value

The number of elements in the list.


duckdb_get_list_child

Stable since 1.2.0.

Returns the LIST child at index as a duckdb_value.

Syntax
duckdb_value duckdb_get_list_child(
  duckdb_value value,
  idx_t index
);
Parameters
  • value: The LIST value.
  • index: The index of the child.
Return Value

The child as a duckdb_value.


duckdb_create_enum_value

Stable since 1.2.0.

Creates an enum value from a type and a value. Must be destroyed with duckdb_destroy_value.

Syntax
duckdb_value duckdb_create_enum_value(
  duckdb_logical_type type,
  uint64_t value
);
Parameters
  • type: The type of the enum
  • value: The value for the enum
Return Value

The enum value, or nullptr.


duckdb_get_enum_value

Stable since 1.2.0.

Returns the enum value of the given value.

Syntax
uint64_t duckdb_get_enum_value(
  duckdb_value value
);
Parameters
  • value: A duckdb_value containing an enum
Return Value

A uint64_t, or MinValue<uint64> if the value cannot be converted


duckdb_get_struct_child

Stable since 1.2.0.

Returns the STRUCT child at index as a duckdb_value.

Syntax
duckdb_value duckdb_get_struct_child(
  duckdb_value value,
  idx_t index
);
Parameters
  • value: The STRUCT value.
  • index: The index of the child.
Return Value

The child as a duckdb_value.


duckdb_value_to_string

Stable since 1.5.6.

Returns the SQL string representation of the given value.

Syntax
char *duckdb_value_to_string(
  duckdb_value value
);
Parameters
  • value: A duckdb_value.
Return Value

The SQL string representation as a null-terminated string. The result must be freed with duckdb_free.


duckdb_value_boolean

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
bool duckdb_value_boolean(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The boolean value at the specified location, or false if the value cannot be converted.


duckdb_value_int8

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
int8_t duckdb_value_int8(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The int8_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_int16

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
int16_t duckdb_value_int16(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The int16_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_int32

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
int32_t duckdb_value_int32(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The int32_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_int64

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
int64_t duckdb_value_int64(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The int64_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_hugeint

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
duckdb_hugeint duckdb_value_hugeint(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted.


duckdb_value_uhugeint

Deprecated Deprecated since 1.0.0, stable since 0.10.0.

This method is scheduled for removal in a future release.

Syntax
duckdb_uhugeint duckdb_value_uhugeint(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_uhugeint value at the specified location, or 0 if the value cannot be converted.


duckdb_value_decimal

Deprecated Deprecated since 1.0.0, stable since 0.3.3.

This method is scheduled for removal in a future release.

Syntax
duckdb_decimal duckdb_value_decimal(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_decimal value at the specified location, or 0 if the value cannot be converted.


duckdb_value_uint8

Deprecated Deprecated since 1.0.0, stable since 0.2.5.

This method is scheduled for removal in a future release.

Syntax
uint8_t duckdb_value_uint8(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The uint8_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_uint16

Deprecated Deprecated since 1.0.0, stable since 0.2.5.

This method is scheduled for removal in a future release.

Syntax
uint16_t duckdb_value_uint16(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The uint16_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_uint32

Deprecated Deprecated since 1.0.0, stable since 0.2.5.

This method is scheduled for removal in a future release.

Syntax
uint32_t duckdb_value_uint32(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The uint32_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_uint64

Deprecated Deprecated since 1.0.0, stable since 0.2.5.

This method is scheduled for removal in a future release.

Syntax
uint64_t duckdb_value_uint64(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The uint64_t value at the specified location, or 0 if the value cannot be converted.


duckdb_value_float

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
float duckdb_value_float(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The float value at the specified location, or 0 if the value cannot be converted.


duckdb_value_double

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
double duckdb_value_double(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The double value at the specified location, or 0 if the value cannot be converted.


duckdb_value_date

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
duckdb_date duckdb_value_date(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_date value at the specified location, or 0 if the value cannot be converted.


duckdb_value_time

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
duckdb_time duckdb_value_time(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_time value at the specified location, or 0 if the value cannot be converted.


duckdb_value_timestamp

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
duckdb_timestamp duckdb_value_timestamp(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_timestamp value at the specified location, or 0 if the value cannot be converted.


duckdb_value_interval

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
duckdb_interval duckdb_value_interval(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_interval value at the specified location, or 0 if the value cannot be converted.


duckdb_value_varchar

Deprecated Deprecated since 1.0.0, stable since 0.1.0.

This method is scheduled for removal in a future release.

Syntax
char *duckdb_value_varchar(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The text value at the specified location as a null-terminated string, or nullptr if the value cannot be converted. The result must be freed with duckdb_free.


duckdb_value_string

Deprecated Deprecated since 1.0.0, stable since 0.6.0.

This method is scheduled for removal in a future release.

Syntax
duckdb_string duckdb_value_string(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The string value at the specified location. Attempts to cast the result value to string.


duckdb_value_varchar_internal

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
char *duckdb_value_varchar_internal(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. If the column is NOT a VARCHAR column this function will return NULL.

The result must NOT be freed.


duckdb_value_string_internal

Deprecated Deprecated since 1.0.0, stable since 0.6.0.

This method is scheduled for removal in a future release.

Syntax
duckdb_string duckdb_value_string_internal(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. If the column is NOT a VARCHAR column this function will return NULL.

The result must NOT be freed.


duckdb_value_blob

Deprecated Deprecated since 1.0.0, stable since 0.2.5.

This method is scheduled for removal in a future release.

Syntax
duckdb_blob duckdb_value_blob(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

The duckdb_blob value at the specified location. Returns a blob with blob.data set to nullptr if the value cannot be converted. The resulting field blob.data must be freed with duckdb_free.


duckdb_value_is_null

Deprecated Deprecated since 1.0.0, stable since 0.2.9.

This method is scheduled for removal in a future release.

Syntax
bool duckdb_value_is_null(
  duckdb_result *result,
  idx_t col,
  idx_t row
);
Return Value

Returns true if the value at the specified index is NULL, and false otherwise.


© 2026 DuckDB Foundation, Amsterdam NL
DuckDB Home Code of Conduct Trademark Use Blog