More database trouble. SQLSTATE should really be a string. Those codes can have leading zeros. If people get comfortable typing them unadorned as 12345, then a 01234 will strip the leading zero, which I think is not valid (the codes need to be exactly 5 characters long). You'd have to pay attention and quote it as '|01234|, and even then it's a symbol instead of a number even though it looks like a number. Or we could have '|12345| also be a symbol, but that's weird because to humans it's a number. The only sensible solution is always string: "12345", "01234", "08P01". MariaDB has errors like this: Error Code 1004 Error ER_CANT_CREATE_FILE SQLSTATE HY000 Description Can't create file '%s' (errno: %d) so a separate proprietary error code and SQLSTATE code. This would look reasonable: (make-foreign-status 'number 1004 'symbol ER_CANT_CREATE_FILE 'sqlstate "HY000" 'message "Can't create file '...' (errno: ...)")