New in v0.5.0.
CREATE TABLE creates a non-streaming, in-memory data source.
Tables store non-streaming data that is inserted via INSERT statements.
When to create a table
You might want to create a table when…
- Manually inserting rows of data into Materialize.
- Testing Materialize’s features without setting up a data stream.
|table_name||A name for the table.|
|col_name||The name of the column to be created in the table.|
|col_type||The data type of the column indicated by col_name.|
|NOT NULL||Do not allow the column to contain NULL values. Columns without this constraint can contain NULL values.|
|default_expr||A default value to use for the column in an
Tables do not persist any data that is inserted. This means that restarting a Materialize instance will lose any data that was previously stored in a table.
Additionally, tables do not currently support:
- Primary keys
- Unique constraints
- Check constraints
- Insert statements that refer to data in other relations, e.g.:
INSERT INTO t1 SELECT * FROM t2
Creating a table
You can create a table
t with the following statement:
CREATE TABLE t (a int, b text NOT NULL);
Once a table is created, you can inspect the table with various
SHOW TABLES; TABLES ------ t SHOW COLUMNS IN t; name nullable type ------------------------- a true int4 b false text