smax-postgres v0.9
PostgreSQL / TimescaleDB logger for SMA-X
Loading...
Searching...
No Matches
sql-types.h File Reference

Macros

#define SQL_BOOLEAN   "BOOLEAN"
 SQL type for a logical true/false value.
 
#define SQL_DATE   "TIMESTAMP"
 SQL date type.
 
#define SQL_DATE_FORMAT   "'%F %H:%M:%S'"
 SQL date format.
 
#define SQL_DOUBLE   "DOUBLE PRECISION"
 SQL type for single precision (32-bit) floating point value.
 
#define SQL_FLOAT   "REAL"
 SQL type for single precision (32-bit) floating point value.
 
#define SQL_INT16   "SMALLINT"
 SQL type for 16-bit integer.
 
#define SQL_INT32   "INTEGER"
 SQL type for 32-bit integer.
 
#define SQL_INT64   "BIGINT"
 SQL type for 64-bit integer.
 
#define SQL_INT8   "SMALLINT"
 8-bit integer is not standard SQL type so bump to 16-bits
 
#define SQL_LAST(id)   "ORDER BY " id " DESC LIMIT 1"
 SQL for selecting last entry.
 
#define SQL_MAX_DOUBLE   (1e100)
 Alternatively use DBL_MIN / DBL_MAX from <float.h>...
 
#define SQL_MIN_DOUBLE   (1e-100)
 SQL does not like doubles with exponent above +- 307.
 
#define SQL_SERIAL   SQL_INT32 " NOT NULL UNIQUE"
 SQL type for serial numbers.
 
#define SQL_TEXT   "VARCHAR"
 SQL text type.
 
#define SQL_VARNAME   SQL_TEXT
 SQL type for storing variable names.
 

Detailed Description

Date
Created on Jan 15, 2024
Author
Attila Kovacs

Equivalent SQL data types across many common SQL flavors