You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(sql): enforce declared integer widths on write and keep them in sync across DDL
Narrowing a column's RowDescription OID to its declared width (issue
#217) is only honest if the stored value actually fits: nodedb keeps
every integer as a full i64, so nothing previously stopped a value
wider than SMALLINT/INTEGER from being written into a column that
advertises a 2- or 4-byte wire type, corrupting the value in transit.
Introduce IntWidth as the single source of truth mapping a declared
type string to its range, PostgreSQL OID, and type name, and route
every consumer through it: write-time range validation in the planner
(INSERT/UPSERT/UPDATE, including KV's separate insert path), a
defence-in-depth check on the read path for data that predates the
constraint, catalog introspection OIDs, and RowDescription narrowing
(replacing the old raw-string refinement). ALTER ADD/RENAME/DROP
COLUMN and ALTER COLUMN TYPE now keep the catalog's declared-type
record in sync so width fidelity survives schema changes instead of
silently reverting to BIGINT. Also fold the sign into negative integer
literals during AST conversion so i64::MIN parses exactly instead of
falling back to an approximate float.
0 commit comments