ALTER STREAM

Documentation

VoltDB Home » Documentation » Using VoltDB

ALTER STREAM

ALTER STREAM — Modifies an existing stream definition.

Synopsis

ALTER STREAM stream-name DROP [COLUMN] column-name

ALTER STREAM stream-name ADD column-definition [BEFORE column-name]

ALTER STREAM stream-name ALTER column-definition

ALTER STREAM stream-name ALTER [COLUMN] column-name SET {DEFAULT value | [NOT] NULL}

column-definition: column-name datatype [DEFAULT value ] [ NOT NULL ]

Description

The ALTER STREAM statement modifies an existing stream by adding, dropping, or modifying a column associated with the stream. You cannot drop or modify the column if there are dependencies on that column. For example, if stored procedure queries reference a dropped or modified column, you cannot make the change. In this case, you must drop the stored procedures before making the change to the stream's schema, then recreate the stored procedures afterwards.

If you drop the stream as a whole (using the DROP STREAM statement) and then redefine it using CREATE STREAM, any pending data not already sent to the stream's export target is deleted. ALTER STREAM, on the other hand, does not interrupt pending data. By using ALTER STREAM to modify the schema of the stream, all previously committed data stays in the queue for the target and any inserts after the schema change are added the queue.

Example

The following example modifies an existing stream, invoice, to modify the definition of the customer column.

ALTER STREAM ALTER COLUMN customer SET NOT NULL;