Unimaginative Username
kiwifarms.net
- Joined
- May 27, 2025
Look, I like SQLite, but I wish it had a pragma that would make it more finicky by strictly enforcing the type declarations for each column. Dynamic typing is fine for simple shell scripts and such, but for more anything more complicated, or with higher demands for consistency, I want static typing (or at least dynamic typing with type checks performed as early as possible).I just wish sqlite had a server-side version. I hate how other databases are so finicky.
Yes, I know that I can write a redundant abomination like
SQL:
CREATE TABLE IF NOT EXISTS employees (
id INTEGER PRIMARY KEY,
firstname TEXT NOT NULL,
lastname TEXT NOT NULL,
ssn CHAR(11) NOT NULL,
CONSTRAINT ck_firstname_type
CHECK (TYPEOF(firstname) = 'text'), -- should be automatic
CONSTRAINT ck_lastname_type
CHECK (TYPEOF(lastname) = 'text'), -- should be automatic
CONSTRAINT ck_ssn_type
CHECK (TYPEOF(ssn) = 'text' AND LENGTH(ssn) = 11), -- should be automatic
CONSTRAINT ck_ssn_format
CHECK (ssn REGEXP '[0-9]{3}-[0-9]{2}-[0-9]{4}')
);