Vous pouvez utiliser un domaine (sur la taille de PostgreSQL).
CREATE DOMAIN my_bytea_8 AS bytea CHECK(length(value) <= 8);
postgres=# SELECT 'NAZDARBAZAR'::my_bytea_8;
ERROR: 23514: value for domain my_bytea_8 violates check constraint "my_bytea_8_check"
SCHEMA NAME: public
DATATYPE NAME: my_bytea_8
CONSTRAINT NAME: my_bytea_8_check
LOCATION: ExecEvalCoerceToDomain, execQual.c:4042