Names and data types
Identifiers, schemas and the PostgreSQL data types and how each is stored.
Names are folded to lower case unless quoted. public.t is the engine table t; another schema s.t is the table s__t (the name prefix of the MSSQL front-end). CREATE SCHEMA records the schema; search_path, SET, RESET, SHOW work. Temporary tables are engine temporary tables of the session.
| PostgreSQL | engine column | answers as |
|---|---|---|
smallint, integer, bigint | SMALLINT, INT, BIGINT | int2, int4, int8 |
serial, bigserial, smallserial, GENERATED .. AS IDENTITY | the integer type with a default NEXTVAL(seq) of a sequence t_col_seq made with the table | int4, int8, int2 |
numeric(p,s), numeric | DECIMAL(p,s), DECIMAL(65,30) (printed without trailing zeros) | numeric with the declared modifier |
real, double precision | FLOAT, DOUBLE | float4, float8 (text as PostgreSQL prints it: 0.1, 1e+20) |
text, varchar(n), char(n) | LONGTEXT, VARCHAR(n), CHAR(n) (padded to n on output) | text, varchar, bpchar |
boolean | TINYINT(1) | bool (t/f) |
date, time, timestamp, timestamptz | DATE, TIME(6), DATETIME(6) (timestamptz is kept in UTC and printed in the session's time zone) | same |
uuid | CHAR(36) (lower case) | uuid |
jsonb | JSON (printed the way PostgreSQL stores it: keys by length then bytes, ": " and ", ") | jsonb |
json | LONGTEXT (kept as written) | json |
bytea | LONGTEXT holding the hex text \x0aff (functions work on the bytes) | bytea |
interval | text (months, days and microseconds, with arithmetic) | interval |
timetz | text of 18 digits: the UTC time and the offset, sorting as PostgreSQL orders the values | timetz |
a domain (CREATE DOMAIN) | the column of its base type; its NOT NULL and CHECK constraints are checked where a value is assigned or cast | the base type |
an enum (CREATE TYPE .. AS ENUM) | DOUBLE: the sort order of the label | the enum's own type, the label as text |
a composite type (CREATE TYPE .. AS (..)) | JSON: an array of the fields | the type's own, the record text (1,x) |
integer[], text[], numeric(p,s)[], ... (two dimensions) | JSON (a JSON array: numbers, booleans, strings, null) | _int4, _text, ... printed as {1,2,"a b",NULL} |
The PostgreSQL type of every column is kept in __pg_col and every expression is typed on the way (1 + 1 is integer, 7 / 2 is 3, 7.0 / 2 is 3.5000000000000000, sum(integer) is bigint), so answers carry PostgreSQL's OIDs and modifiers and values are printed by type.