set_default Action

Implement the set_default DoAction to support ALTER TABLE ALTER COLUMN SET DEFAULT statements for defining column default values.

The set_default action sets or updates the default value for a column. This action is invoked when executing an ALTER TABLE ... ALTER COLUMN ... SET DEFAULT SQL statement.

SQL Example

ALTER TABLE example.main.employees ALTER COLUMN status SET DEFAULT 'active';
ALTER TABLE example.main.employees ALTER COLUMN hire_date SET DEFAULT CURRENT_DATE;

Input Parameters

The action receives a single msgpack-serialized parameter:

// The base class for all alter parameters.
struct AirportAlterBase
{
  //! Catalog name to alter
  std::string catalog;
  //! Schema name to alter
  std::string schema;
  //! Entry name to alter
  std::string name;
  bool ignore_not_found;
};

struct AirportAlterTableSetDefaultParameters : AirportAlterBase
{
  std::string column_name;
  std::string expression;

  MSGPACK_DEFINE_MAP(catalog, schema, name, column_name, expression);
};

Return Value

The action does not return a value. If an error occurs, the server must raise an Arrow Flight exception with an appropriate error message.