setHaMvccColumnDefaultValue

Syntax

setHaMvccColumnDefaultValue(table, colName, defaultValue)

Details

Sets the default values for specified columns of an HA MVCC table.

Notes: This function must be executed on the Leader node of the Raft group that the table belongs to.

Parameters

table is an HA MVCC table indicating the table to modify.

colName is a STRING scalar or vector indicating the column name(s) for which to set default values (single or multiple columns).

defaultValue is a scalar/tuple of any type indicating the column default value(s). If colName is a vector, defaultValue must be a tuple of the same length as colName.

Examples

// Create an haMvccTable
schemaTb = table(1:0, `id`v, [INT, DOUBLE])
t = haMvccTable(1:0, schemaTb, "haT2", 2)

// Set the default value of the name column to A001
setHaMvccColumnDefaultValue(t, "v", 0.0)
// Set the default value of the `id` column to 1, and the default value of the `value` column to 3.6
setHaMvccColumnDefaultValue(t, ["id","v"], (0, 0.0))

Related function: haMvccTable