Skip to main content
vsql_complex adds a COMPLEX column type that stores a complex number as two doubles, with the arithmetic to go with it. It ships inside the server as a worked example of a custom type, and it shows what a VEF type needs end to end: a binary layout, a text form, a comparison rule, and an aggregate.

Install

vsql_complex lives in the server source tree, so its bundle is present after every install method, including a build from source. Install it into the server with one statement:
Confirm it is there:

What it adds

The COMPLEX type

A value is written '(real,imaginary)' and occupies 16 bytes. The bundle also registers a COMPLEX2 variant, which this page does not cover.

Functions

Example

Multiplying by (0,1) rotates a value a quarter turn, and the aggregate adds a whole column:

See also