set_not_null Action

Implement the set_not_null DoAction to support ALTER TABLE ALTER COLUMN SET NOT NULL statements for adding column constraints.

The set_not_null action adds a NOT NULL constraint to a column, ensuring it cannot accept null values. This action is invoked when executing an ALTER TABLE ... ALTER COLUMN ... SET NOT NULL SQL statement.

SQL Example

ALTER TABLE example.main.employees ALTER COLUMN email SET NOT NULL;
ALTER TABLE example.main.employees ALTER COLUMN employee_id SET NOT NULL;

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 AirportAlterTableSetNotNullParameters : AirportAlterBase
{
  std::string column_name;

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

Return Value

The action does not return a value. If an error occurs (such as when existing rows contain null values), the server must raise an Arrow Flight exception with an appropriate error message.