Skip to main content

Module constraint_id

Module constraint_id 

Source
Expand description

Hover for constraint / index / trigger identifiers.

Conventional Postgres style prefixes object names with a 2-3 letter tag indicating their kind:

pk_ primary key fk_ foreign key uq_ unique constraint uidx_ unique index idx_ index ix_ index (alt) ch_ check constraint chk_ check (alt) tg_ trigger tr_ trigger (alt) trg_ trigger (alt)

We use the prefix as a quick classifier, then try to look up the actual object in the catalog (constraints + indexes + triggers attached to each table). When we find a match we render its real definition; otherwise we still render an “expected to be a ” card so the user gets useful context.

Enums§

Kind

Functions§

classify
Classify a token by its conventional prefix. Order matters – uidx_ must be checked before idx_.
render_for
Look the identifier up in the catalog and render a card. Returns None when the token does not match the constraint-identifier convention.