Alignment in sqlparser::ast - Rust

pub enum Alignment {
    Char,
    Int2,
    Int4,
    Double,
}
Expand description

Alignment specification for PostgreSQL user-defined base types.

Specifies the storage alignment requirement for values of the data type. The allowed values equate to alignment on 1, 2, 4, or 8 byte boundaries. Note that variable-length types must have an alignment of at least 4, since they necessarily contain an int4 as their first component.

§PostgreSQL Documentation

See: https://www.postgresql.org/docs/current/sql-createtype.html

§Examples

CREATE TYPE mytype (
    INPUT = in_func,
    OUTPUT = out_func,
    ALIGNMENT = int4  -- 4-byte alignment
);
§

Single-byte alignment: ALIGNMENT = char

§

2-byte alignment: ALIGNMENT = int2

§

4-byte alignment: ALIGNMENT = int4

§

8-byte alignment: ALIGNMENT = double

§
§
§
§
§
§