Search
ctrl/
Ask AI
Light
Dark
System

Scalars

Subtopics

Data in EdgeDB is composed from: numbers, booleans, text, date, time, or JSON. So let's start with learning what these scalar types are and how they interact with each other.

Boolean values are represented by the words "true" and "false" (case-insensitive). Try selecting a boolean literal:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

String literals are anything put inside a pair of either single or double quotes. They also support special escaped characters, such as "\n" for a new line or even exotic unicode like emojis. Try them out:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Bytes are very similar to strings in structure, but bytes literals start with a b prefix. Since the characters inside the bytes literal are supposed to represent one byte each, no non-ascii unicode characters are allowed. Try them out:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

But emojis and even common accented characters represent more than one byte and aren't allowed in a bytes literal:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Numbers can be divided into two categories based on whether they are of fixed finite size in memory or unlimited. By default, number literals represent the fixed-size integer or floating-point numbers used in many programming languages. Try them out:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

Integers that are too large to fit into 64 bits will result in an error:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input

However, if you add n at the end of this very big integer, EdgeDB will know that this is supposed to be a number without any upper limit. Try adding n at the end to make the error go away.

Similarly, the n suffix tells EdgeDB to treat floating point numbers as if they had infinite precision. Try the following example with and without the n suffix:

Input
Run
Output Objects
Press the 'Run' button to evaluate the input