Skip to content
excalibase
numbers
Connectstable

Numbers

Every number type has one wire format, the same in GraphQL and REST, on PostgreSQL and MySQL:

Column typeSent asExample
smallint, integer (MySQL tinyint, mediumint, int)JSON number42
real, double precision (MySQL float, double)JSON number0.25
bigint (MySQL bigint, bigint unsigned)string"9223372036854775807"
numeric, decimalstring, with the column's scale"19.90"
arrays of the above (PostgreSQL)array of the element's form["1", "2"]

The aggregate sum and avg of a bigint or decimal column are strings too. Realtime changes carry the same form as a query.

Why strings

JavaScript reads every JSON number as a 64-bit float. It holds integers exactly only up to 2^53 (9007199254740991) and about 15 significant digits, so a bigint id or a money amount sent as a number can arrive changed, with no error. A string arrives with every digit. Hasura offers the same as an option (stringify numeric types); here it is always on.

Sending them

Filters and writes take either a string or a number, so price=eq.19.90, {"price": "19.90"} and { price: { eq: 19.90 } } all work. Send a string when the value has more digits than a float keeps.

In your code

Generated types (the SDK's codegen and the MCP generate_typescript_types tool) say string for these columns. Convert before doing arithmetic: Number(row.price) when rounding is fine, a decimal library such as decimal.js when it is not (money).