Skip to main content

dsl_knowledge/tables/
types.rs

1//! SQL data type table. Append new types with the `t!` macro.
2
3use crate::entry::{Entry, Kind, pg};
4use std::collections::HashMap;
5
6pub fn build() -> HashMap<&'static str, Entry> {
7  let mut m = HashMap::new();
8  macro_rules! t {
9    ($label:expr, $doc:expr, $example:expr, $url:expr) => {
10      // Panic on a duplicate label rather than silently overwriting --
11      // a HashMap::insert collision here means a second entry for the
12      // same type was added without noticing the first, and whichever
13      // one lost would go permanently dead with no warning. See the
14      // 2026-08-18 dedup commit, which found and removed 7 pre-existing
15      // duplicates this same way.
16      if let Some(prev) = m.insert(
17        $label,
18        Entry { label: $label, kind: Kind::Type, doc: $doc, signature: None, example: $example, url: $url },
19      ) {
20        panic!(
21          "duplicate dsl-knowledge type entry {:?}: new doc {:?} would silently replace existing doc {:?}",
22          $label, $doc, prev.doc
23        );
24      }
25    };
26  }
27
28  t!("BOOLEAN", "true / false / NULL.", "is_active BOOLEAN NOT NULL DEFAULT false", pg("datatype-boolean.html"));
29  t!("SMALLINT", "2-byte signed integer.", "qty SMALLINT", pg("datatype-numeric.html"));
30  t!("INTEGER", "4-byte signed integer. Alias INT.", "count INTEGER NOT NULL", pg("datatype-numeric.html"));
31  t!("INT", "4-byte signed integer (alias for INTEGER).", "count INT NOT NULL", pg("datatype-numeric.html"));
32  t!("INT2", "Postgres-internal name for SMALLINT (2-byte signed).", "qty INT2", pg("datatype-numeric.html"));
33  t!("INT4", "Postgres-internal name for INTEGER (4-byte signed).", "count INT4", pg("datatype-numeric.html"));
34  t!("INT8", "Postgres-internal name for BIGINT (8-byte signed).", "id INT8", pg("datatype-numeric.html"));
35  t!(
36    "FLOAT4",
37    "Postgres-internal name for REAL (4-byte IEEE float).",
38    "weight FLOAT4",
39    pg("datatype-numeric.html#DATATYPE-FLOAT")
40  );
41  t!(
42    "FLOAT8",
43    "Postgres-internal name for DOUBLE PRECISION (8-byte float).",
44    "ratio FLOAT8",
45    pg("datatype-numeric.html#DATATYPE-FLOAT")
46  );
47  t!(
48    "DECIMAL",
49    "Exact decimal. Synonym for NUMERIC.",
50    "price DECIMAL(10, 2)",
51    pg("datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL")
52  );
53  t!(
54    "MONEY",
55    "Currency amount. Locale-formatted. Prefer NUMERIC for portability.",
56    "amount MONEY",
57    pg("datatype-money.html")
58  );
59  t!("BOOL", "Alias for BOOLEAN.", "active BOOL NOT NULL DEFAULT false", pg("datatype-boolean.html"));
60  t!(
61    "TIMETZ",
62    "TIME WITH TIME ZONE -- rarely useful, see datatype docs for caveats.",
63    "open_at TIMETZ",
64    pg("datatype-datetime.html")
65  );
66
67  t!("CIDR", "IPv4 / IPv6 network. Stricter than INET (no host bits).", "subnet CIDR", pg("datatype-net-types.html"));
68  t!("MACADDR", "6-byte MAC address.", "mac MACADDR", pg("datatype-net-types.html"));
69  t!("MACADDR8", "8-byte EUI-64 MAC address.", "mac8 MACADDR8", pg("datatype-net-types.html"));
70
71  t!("OID", "Object identifier. Internal Postgres reference type.", "ref OID", pg("datatype-oid.html"));
72  t!("XML", "XML document. Stored as text; needs libxml support.", "payload XML", pg("datatype-xml.html"));
73  t!("TSVECTOR", "Tokenised full-text search vector.", "search_doc TSVECTOR", pg("datatype-textsearch.html"));
74  t!("TSQUERY", "Full-text search query.", "q TSQUERY", pg("datatype-textsearch.html"));
75  t!("POINT", "Geometric point (x, y).", "p POINT", pg("datatype-geometric.html"));
76  t!("LINE", "Geometric infinite line.", "l LINE", pg("datatype-geometric.html"));
77  t!("BOX", "Geometric rectangular box.", "b BOX", pg("datatype-geometric.html"));
78  t!("POLYGON", "Closed geometric polygon.", "shape POLYGON", pg("datatype-geometric.html"));
79  t!("CIRCLE", "Geometric circle (center + radius).", "c CIRCLE", pg("datatype-geometric.html"));
80  t!("BIGINT", "8-byte signed integer.", "id BIGINT", pg("datatype-numeric.html"));
81  t!(
82    "NUMERIC",
83    "Exact decimal with up to 1000 digits. `NUMERIC(precision, scale)` -- e.g. NUMERIC(10,2) \
84        means 8 digits before the decimal and 2 after. Without (precision, scale) it stores any \
85        scale up to system limits. Default text format omits trailing zeros; use `to_char(n, '999G999D00')` \
86        for fixed formatting. Aliases: DECIMAL.",
87    "price NUMERIC(10, 2) NOT NULL",
88    pg("datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL")
89  );
90  t!("REAL", "4-byte IEEE float.", "weight REAL", pg("datatype-numeric.html#DATATYPE-FLOAT"));
91  t!("DOUBLE PRECISION", "8-byte IEEE float.", "ratio DOUBLE PRECISION", pg("datatype-numeric.html#DATATYPE-FLOAT"));
92  t!(
93    "SERIAL",
94    "Auto-incrementing INTEGER backed by a sequence.",
95    "id SERIAL PRIMARY KEY",
96    pg("datatype-numeric.html#DATATYPE-SERIAL")
97  );
98  t!("BIGSERIAL", "BIGINT auto-increment.", "id BIGSERIAL PRIMARY KEY", pg("datatype-numeric.html#DATATYPE-SERIAL"));
99  t!(
100    "VARCHAR",
101    "Variable-length character with optional length cap.",
102    "name VARCHAR(255) NOT NULL",
103    pg("datatype-character.html")
104  );
105  t!(
106    "TEXT",
107    "Variable-length character with no cap. Default choice in Postgres.",
108    "body TEXT NOT NULL",
109    pg("datatype-character.html")
110  );
111  t!("CHAR", "Fixed-length, blank-padded.", "code CHAR(3)", pg("datatype-character.html"));
112  t!("BYTEA", "Binary blob.", "avatar BYTEA", pg("datatype-binary.html"));
113  t!(
114    "DATE",
115    "Calendar date, no time, no zone. Default output is ISO 8601 `YYYY-MM-DD`. \
116        Accepted inputs: `'2026-01-15'` (ISO), `'15-Jan-2026'`, `'20260115'`, `current_date`, \
117        plus `DATE 'YYYY-MM-DD'` literals.",
118    "birth_date DATE DEFAULT current_date",
119    pg("datatype-datetime.html")
120  );
121  t!(
122    "TIME",
123    "Time of day without time zone. Default output `HH24:MI:SS[.ffffff]`. \
124        Accepted inputs: `'14:30'`, `'14:30:00'`, `'14:30:00.123456'`. \
125        Use `TIME WITH TIME ZONE` (TIMETZ) for zone-aware values (rarely useful).",
126    "open_at TIME DEFAULT '09:00'",
127    pg("datatype-datetime.html")
128  );
129  t!(
130    "TIMESTAMP",
131    "Date + time WITHOUT time zone. Default output `YYYY-MM-DD HH24:MI:SS[.ffffff]`. \
132        Avoid for application data: use TIMESTAMPTZ instead so daylight-saving and \
133        cross-region inserts stay correct. Accepted inputs: `'2026-01-15 14:30'`, \
134        `'2026-01-15T14:30:00'`, `current_timestamp`.",
135    "ts TIMESTAMP",
136    pg("datatype-datetime.html")
137  );
138  t!(
139    "TIMESTAMPTZ",
140    "Date + time WITH time zone. Storage is always UTC; the session `TimeZone` \
141        decides input parsing and display. Default output `YYYY-MM-DD HH24:MI:SS+00`. \
142        Accepted inputs: `'2026-01-15 14:30Z'`, `'2026-01-15 14:30+02'`, \
143        `'2026-01-15 14:30:00 Europe/Berlin'`, `now()`, `current_timestamp`. \
144        Formatting helpers: `to_char(ts, 'YYYY-MM-DD HH24:MI:SS TZ')`, \
145        `to_char(ts, 'Day, DD Mon YYYY')`, `to_char(ts, 'IYYY-IW')` (ISO week).",
146    "created_at TIMESTAMPTZ NOT NULL DEFAULT now()",
147    pg("datatype-datetime.html")
148  );
149  t!(
150    "INTERVAL",
151    "Time span. Accepted inputs: `INTERVAL '1 day 2 hours 3 minutes'`, \
152        `INTERVAL '90 seconds'`, `INTERVAL '1-2'` (years-months), `INTERVAL 'P1DT2H'` (ISO 8601). \
153        Field selectors: `INTERVAL '1' YEAR / MONTH / DAY / HOUR / MINUTE / SECOND`.",
154    "deleted_after INTERVAL DEFAULT '30 days'",
155    pg("datatype-datetime.html#DATATYPE-INTERVAL-INPUT")
156  );
157  t!(
158    "UUID",
159    "128-bit identifier. Canonical text form: `'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'`. \
160        Generators: `gen_random_uuid()` (v4, Postgres 13+), `uuid_generate_v4()` (uuid-ossp). \
161        Accepts hex with or without dashes; output is always dashed lowercase.",
162    "id UUID PRIMARY KEY DEFAULT gen_random_uuid()",
163    pg("datatype-uuid.html")
164  );
165  t!(
166    "JSON",
167    "JSON stored verbatim. Whitespace and key order preserved. Slower for queries than JSONB. \
168        Operators: `->` (key as json), `->>` (key as text), `#>` (path), `#>>` (path as text). \
169        Validation happens on input.",
170    "metadata JSON DEFAULT '{}'::json",
171    pg("datatype-json.html")
172  );
173  t!(
174    "JSONB",
175    "Binary JSON. Indexable, fast, the right default for application data. \
176        Operators add `@>` (contains), `<@` (contained), `?` (key exists), `?|` (any), `?&` (all). \
177        Build with `jsonb_build_object('k', v, ...)`; mutate with `jsonb_set(j, path, value)`.",
178    "metadata JSONB NOT NULL DEFAULT '{}'::jsonb",
179    pg("datatype-json.html")
180  );
181  t!("INET", "IPv4 / IPv6 host or network.", "client_ip INET", pg("datatype-net-types.html"));
182
183  // disjoint ranges.
184  t!(
185    "INT4RANGE",
186    "Range of integer. `'[1,10)'::int4range`. Use `@>` for containment, `&&` for overlap.",
187    "valid_ids INT4RANGE",
188    pg("rangetypes.html")
189  );
190  t!("INT8RANGE", "Range of bigint.", "id_window INT8RANGE", pg("rangetypes.html"));
191  t!("NUMRANGE", "Range of numeric.", "price_band NUMRANGE", pg("rangetypes.html"));
192  t!("TSRANGE", "Range of timestamp without time zone.", "valid TSRANGE", pg("rangetypes.html"));
193  t!(
194    "TSTZRANGE",
195    "Range of timestamp with time zone. The right default for time-bounded data.",
196    "active TSTZRANGE NOT NULL",
197    pg("rangetypes.html")
198  );
199  t!("DATERANGE", "Range of date.", "booking DATERANGE", pg("rangetypes.html"));
200  t!(
201    "INT4MULTIRANGE",
202    "Multirange of integer (PG 14+). Set of disjoint int4ranges.",
203    "windows INT4MULTIRANGE",
204    pg("rangetypes.html")
205  );
206  t!("INT8MULTIRANGE", "Multirange of bigint (PG 14+).", "windows INT8MULTIRANGE", pg("rangetypes.html"));
207  t!("NUMMULTIRANGE", "Multirange of numeric (PG 14+).", "bands NUMMULTIRANGE", pg("rangetypes.html"));
208  t!("TSMULTIRANGE", "Multirange of timestamp (PG 14+).", "windows TSMULTIRANGE", pg("rangetypes.html"));
209  t!(
210    "TSTZMULTIRANGE",
211    "Multirange of timestamp with time zone (PG 14+).",
212    "active TSTZMULTIRANGE",
213    pg("rangetypes.html")
214  );
215  t!("DATEMULTIRANGE", "Multirange of date (PG 14+).", "blackout DATEMULTIRANGE", pg("rangetypes.html"));
216
217  // ---- Bit / serial / lsn / geometric ----
218  t!("BIT", "Fixed-width bit string. BIT(n).", "flags BIT(8)", pg("datatype-bit.html"));
219  t!("VARBIT", "Variable-width bit string. BIT VARYING(n).", "mask VARBIT(64)", pg("datatype-bit.html"));
220  t!(
221    "SMALLSERIAL",
222    "Auto-increment INT2. Sugar for INT2 + sequence + NOT NULL.",
223    "id SMALLSERIAL PRIMARY KEY",
224    pg("datatype-numeric.html#DATATYPE-SERIAL")
225  );
226  t!(
227    "PG_LSN",
228    "Postgres log sequence number (8 bytes). Used for WAL positions.",
229    "lsn PG_LSN",
230    pg("datatype-pg-lsn.html")
231  );
232  t!("LSEG", "Geometric line segment.", "edge LSEG", pg("datatype-geometric.html"));
233  t!("PATH", "Geometric path (closed or open).", "trail PATH", pg("datatype-geometric.html"));
234  t!(
235    "REGCLASS",
236    "OID alias for tables / sequences / views. Validates the name at parse.",
237    "tbl REGCLASS",
238    pg("datatype-oid.html")
239  );
240  t!("REGPROC", "OID alias for functions (no argument types).", "fn REGPROC", pg("datatype-oid.html"));
241  t!("REGTYPE", "OID alias for types.", "ty REGTYPE", pg("datatype-oid.html"));
242  t!("REGROLE", "OID alias for roles.", "r REGROLE", pg("datatype-oid.html"));
243  t!("REGNAMESPACE", "OID alias for schemas.", "ns REGNAMESPACE", pg("datatype-oid.html"));
244
245  // ---- pseudo + REG + standard-spelling sweep ---------------
246  t!(
247    "ANY",
248    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
249    "x ANY",
250    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
251  );
252  t!(
253    "ANYARRAY",
254    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
255    "x ANYARRAY",
256    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
257  );
258  t!(
259    "ANYCOMPATIBLE",
260    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
261    "x ANYCOMPATIBLE",
262    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
263  );
264  t!(
265    "ANYCOMPATIBLEARRAY",
266    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
267    "x ANYCOMPATIBLEARRAY",
268    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
269  );
270  t!(
271    "ANYCOMPATIBLEMULTIRANGE",
272    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
273    "x ANYCOMPATIBLEMULTIRANGE",
274    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
275  );
276  t!(
277    "ANYCOMPATIBLENONARRAY",
278    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
279    "x ANYCOMPATIBLENONARRAY",
280    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
281  );
282  t!(
283    "ANYCOMPATIBLERANGE",
284    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
285    "x ANYCOMPATIBLERANGE",
286    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
287  );
288  t!(
289    "ANYELEMENT",
290    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
291    "x ANYELEMENT",
292    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
293  );
294  t!(
295    "ANYENUM",
296    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
297    "x ANYENUM",
298    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
299  );
300  t!(
301    "ANYMULTIRANGE",
302    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
303    "x ANYMULTIRANGE",
304    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
305  );
306  t!(
307    "ANYNONARRAY",
308    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
309    "x ANYNONARRAY",
310    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
311  );
312  t!(
313    "ANYRANGE",
314    "Polymorphic pseudo-type accepted by functions; bound to a concrete type at call time.",
315    "x ANYRANGE",
316    pg("extend-type-system.html#EXTEND-TYPES-POLYMORPHIC")
317  );
318  t!(
319    "CSTRING",
320    "Pseudo-type internal to PG -- not usable in user table columns.",
321    "x CSTRING",
322    pg("datatype-pseudo.html")
323  );
324  t!("DEC", "SQL standard alias for NUMERIC / DECIMAL.", "price DEC(10,2)", pg("datatype-numeric.html"));
325  t!(
326    "EVENT_TRIGGER",
327    "Pseudo-type internal to PG -- not usable in user table columns.",
328    "x EVENT_TRIGGER",
329    pg("datatype-pseudo.html")
330  );
331  t!(
332    "FDW_HANDLER",
333    "Pseudo-type for the entry point of a feature handler. Cannot appear in user SQL.",
334    "x FDW_HANDLER",
335    pg("extend-type-system.html")
336  );
337  t!(
338    "INDEX_AM_HANDLER",
339    "Pseudo-type for the entry point of a feature handler. Cannot appear in user SQL.",
340    "x INDEX_AM_HANDLER",
341    pg("extend-type-system.html")
342  );
343  t!(
344    "INTERNAL",
345    "Pseudo-type internal to PG -- not usable in user table columns.",
346    "x INTERNAL",
347    pg("datatype-pseudo.html")
348  );
349  t!(
350    "JSONPATH",
351    "JSONPath expression value -- used by jsonb_path_* functions.",
352    "p JSONPATH",
353    pg("datatype-json.html#DATATYPE-JSONPATH")
354  );
355  t!(
356    "LANGUAGE_HANDLER",
357    "Pseudo-type for the entry point of a feature handler. Cannot appear in user SQL.",
358    "x LANGUAGE_HANDLER",
359    pg("extend-type-system.html")
360  );
361  t!(
362    "NAME",
363    "63-byte identifier -- internal PG type used in pg_catalog rows.",
364    "-- pg_catalog only",
365    pg("datatype-character.html")
366  );
367  t!(
368    "NATIONAL CHAR",
369    "SQL standard alias for CHARACTER (NCHAR = national char). PG treats them as plain text.",
370    "c NATIONAL CHAR(20)",
371    pg("datatype-character.html")
372  );
373  t!(
374    "NATIONAL CHARACTER",
375    "SQL standard alias for CHARACTER (NCHAR = national char). PG treats them as plain text.",
376    "c NATIONAL CHARACTER(20)",
377    pg("datatype-character.html")
378  );
379  t!(
380    "NCHAR",
381    "SQL standard alias for CHARACTER (NCHAR = national char). PG treats them as plain text.",
382    "c NCHAR(20)",
383    pg("datatype-character.html")
384  );
385  t!(
386    "OPAQUE",
387    "Pseudo-type internal to PG -- not usable in user table columns.",
388    "x OPAQUE",
389    pg("datatype-pseudo.html")
390  );
391  t!(
392    "PG_DDL_COMMAND",
393    "Pseudo-type internal to PG -- not usable in user table columns.",
394    "x PG_DDL_COMMAND",
395    pg("datatype-pseudo.html")
396  );
397  t!(
398    "PG_SNAPSHOT",
399    "Visibility snapshot -- replaces deprecated txid_snapshot.",
400    "snap PG_SNAPSHOT",
401    pg("datatype-pg-lsn.html")
402  );
403  t!(
404    "RECORD",
405    "Pseudo-type internal to PG -- not usable in user table columns.",
406    "x RECORD",
407    pg("datatype-pseudo.html")
408  );
409  t!(
410    "REGCOLLATION",
411    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
412    "t REGCOLLATION",
413    pg("datatype-oid.html")
414  );
415  t!(
416    "REGCONFIG",
417    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
418    "t REGCONFIG",
419    pg("datatype-oid.html")
420  );
421  t!(
422    "REGDICTIONARY",
423    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
424    "t REGDICTIONARY",
425    pg("datatype-oid.html")
426  );
427  t!(
428    "REGOPER",
429    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
430    "t REGOPER",
431    pg("datatype-oid.html")
432  );
433  t!(
434    "REGOPERATOR",
435    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
436    "t REGOPERATOR",
437    pg("datatype-oid.html")
438  );
439  t!(
440    "REGPROCEDURE",
441    "Object-identifier alias type -- accepts a name + resolves to OID. Useful in queries against pg_catalog.",
442    "t REGPROCEDURE",
443    pg("datatype-oid.html")
444  );
445  t!(
446    "TABLE_AM_HANDLER",
447    "Pseudo-type for the entry point of a feature handler. Cannot appear in user SQL.",
448    "x TABLE_AM_HANDLER",
449    pg("extend-type-system.html")
450  );
451  t!(
452    "TIMESTAMP WITHOUT TIME ZONE",
453    "SQL standard spelling for the time/timestamp variants (with/without time zone).",
454    "x TIMESTAMP WITHOUT TIME ZONE",
455    pg("datatype-datetime.html")
456  );
457  t!(
458    "TIMESTAMP WITH TIME ZONE",
459    "SQL standard spelling for the time/timestamp variants (with/without time zone).",
460    "x TIMESTAMP WITH TIME ZONE",
461    pg("datatype-datetime.html")
462  );
463  t!(
464    "TIME WITHOUT TIME ZONE",
465    "SQL standard spelling for the time/timestamp variants (with/without time zone).",
466    "x TIME WITHOUT TIME ZONE",
467    pg("datatype-datetime.html")
468  );
469  t!(
470    "TIME WITH TIME ZONE",
471    "SQL standard spelling for the time/timestamp variants (with/without time zone).",
472    "x TIME WITH TIME ZONE",
473    pg("datatype-datetime.html")
474  );
475  t!(
476    "TRIGGER",
477    "Pseudo-type internal to PG -- not usable in user table columns.",
478    "x TRIGGER",
479    pg("datatype-pseudo.html")
480  );
481  t!(
482    "TSM_HANDLER",
483    "Pseudo-type for the entry point of a feature handler. Cannot appear in user SQL.",
484    "x TSM_HANDLER",
485    pg("extend-type-system.html")
486  );
487  t!("TXID_SNAPSHOT", "Deprecated -- use PG_SNAPSHOT in PG13+.", "snap TXID_SNAPSHOT", pg("datatype-pg-lsn.html"));
488  t!(
489    "UNKNOWN",
490    "Pseudo-type internal to PG -- not usable in user table columns.",
491    "x UNKNOWN",
492    pg("datatype-pseudo.html")
493  );
494  t!("VOID", "Pseudo-type internal to PG -- not usable in user table columns.", "x VOID", pg("datatype-pseudo.html"));
495  t!(
496    "XID",
497    "4-byte transaction id. Wraps around -- compare with `txid_*` fns or convert to `xid8` (PG13+) for full ordering.",
498    "id XID",
499    pg("datatype-oid.html")
500  );
501  t!(
502    "XID8",
503    "8-byte transaction id (PG13+) -- no wraparound concerns. Pair with `pg_snapshot`.",
504    "id XID8",
505    pg("datatype-oid.html")
506  );
507  t!(
508    "ACLITEM",
509    "Single ACL entry stored inside an aclitem[] (used by pg_class.relacl etc). Read via `aclexplode()` / `pg_get_userbyid()`.",
510    "x ACLITEM",
511    pg("ddl-priv.html")
512  );
513
514  // ---- Extension types ----
515  t!(
516    "HSTORE",
517    "Key/value text map (hstore extension). Use jsonb instead in new code.",
518    "tags HSTORE",
519    "https://www.postgresql.org/docs/current/hstore.html"
520  );
521  t!(
522    "VECTOR",
523    "Dense float vector (pgvector extension). Specify dimensions: VECTOR(1536).",
524    "embedding VECTOR(1536)",
525    "https://github.com/pgvector/pgvector"
526  );
527  t!(
528    "HALFVEC",
529    "Half-precision (float2) vector (pgvector 0.7+). Half the storage of VECTOR.",
530    "embedding HALFVEC(1536)",
531    "https://github.com/pgvector/pgvector"
532  );
533  t!(
534    "BIT_VEC",
535    "Binary vector (pgvector 0.7+). Bit-packed for hamming/jaccard distance.",
536    "fp BIT_VEC(64)",
537    "https://github.com/pgvector/pgvector"
538  );
539  t!(
540    "SPARSEVEC",
541    "Sparse vector (pgvector 0.7+). Only stores nonzero indices.",
542    "v SPARSEVEC(10000)",
543    "https://github.com/pgvector/pgvector"
544  );
545  t!(
546    "LTREE",
547    "Hierarchical label tree (ltree extension). Use ~ and @> for ancestor queries.",
548    "path LTREE",
549    "https://www.postgresql.org/docs/current/ltree.html"
550  );
551  t!("LQUERY", "ltree label path query.", "q LQUERY", "https://www.postgresql.org/docs/current/ltree.html");
552  t!("LTXTQUERY", "ltree full-text query.", "q LTXTQUERY", "https://www.postgresql.org/docs/current/ltree.html");
553  t!(
554    "CITEXT",
555    "Case-insensitive text (citext extension). UNIQUE/= compare folded.",
556    "email CITEXT",
557    "https://www.postgresql.org/docs/current/citext.html"
558  );
559  t!("ISBN", "ISBN identifier (isn extension).", "x ISBN", "https://www.postgresql.org/docs/current/isn.html");
560  t!("ISSN", "ISSN identifier (isn extension).", "x ISSN", "https://www.postgresql.org/docs/current/isn.html");
561  t!(
562    "CUBE",
563    "Multi-dim cube (cube extension). Used by earthdistance.",
564    "c CUBE",
565    "https://www.postgresql.org/docs/current/cube.html"
566  );
567  t!(
568    "EARTH",
569    "earth-distance type (earthdistance extension).",
570    "e EARTH",
571    "https://www.postgresql.org/docs/current/earthdistance.html"
572  );
573  t!("SEG", "Floating point intervals (seg extension).", "x SEG", "https://www.postgresql.org/docs/current/seg.html");
574  // ---- PostGIS ----
575  t!(
576    "GEOMETRY",
577    "PostGIS geometry. Specify subtype/SRID: GEOMETRY(Point, 4326).",
578    "geom GEOMETRY(Point, 4326)",
579    "https://postgis.net/docs/geometry.html"
580  );
581  t!(
582    "GEOGRAPHY",
583    "PostGIS geography (spherical, computations in meters).",
584    "loc GEOGRAPHY(Point, 4326)",
585    "https://postgis.net/docs/geography.html"
586  );
587  t!("RASTER", "PostGIS raster type.", "tile RASTER", "https://postgis.net/docs/raster.html");
588  // ---- TimescaleDB ----
589  t!(
590    "HYPERTABLE",
591    "TimescaleDB virtual table -- not a real column type; created via create_hypertable().",
592    "-- see create_hypertable()",
593    "https://docs.timescale.com/"
594  );
595
596  m
597}