01008
PostgreSQLWARNINGCriticalWarningHIGH confidence
implicit zero bit padding
What this means
SQLSTATE 01008 is raised when a bit-string value is implicitly padded with zero bits to fit the declared length of a BIT(n) column. The statement succeeds but data was silently altered.
Why it happens
- 1Inserting or updating a BIT(n) column with a shorter bit string than n bits
How to reproduce
Inserting a short bit string into a fixed-length BIT column.
trigger — this will error
trigger — this will error
CREATE TABLE flags (f BIT(8)); INSERT INTO flags VALUES (B'101'); -- padded to 00000101
expected output
WARNING: implicit zero bit padding
Fix
Provide the exact bit width expected by the column
WHEN When inserting bit strings into BIT(n) columns.
Provide the exact bit width expected by the column
INSERT INTO flags VALUES (B'00000101');
Why this works
Supplying the full bit width prevents implicit padding and avoids the warning.
Sources
Official documentation ↗
Class 01 — Warning
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev