Yeah my DB is the one place I want strict types. Well also RPCs. But SQLite is a somewhat different set of use cases, so maybe I'd understand https://sqlite.org/flextypegood.html more if I were using it. Like there's a point about random scripts not made for SQLite happening to work with it, which isn't normally a consideration for other DBMSes.
> Yeah my DB is the one place I want strict types. Well also RPCs. Which is why in most cases you are going to show at compile time that your code adheres to the typed structure. The SQLite schema you are developing alongside provides the type information for static analysis. There is no real benefit in also double checking again at runtime. Your code isn't going to magically mutate in a way that it starts inserting…
Prefer strict tables in SQLite
101–110 of 188 posts
Re: Prefer strict tables in SQLite
#102“NUL characters (ASCII code 0x00 and Unicode \u0000) may appear in the middle of strings in SQLite. This can lead to unexpected behavior.”
Re: Prefer strict tables in SQLite
#103I think I can see how dynamic data types make sense (eg flat key/value store), but my question would be: What is least surprising? That INTEGER implicity accepts 'hello world' without error, or that you can't insert such a value unless you use a keyword like NONSTRICT or a type like ANY? I would wager the vast majority of SQLite users if asked would probably not expect it to work.
Otherwise, yeah, it's very surprising to explicitly put INTEGER and still be able to insert text. It's not like the user left the type out.
Re: Prefer strict tables in SQLite
#104Earlier quoted context omitted.
Well, I would also like a proper datetime/timestamp datatype that isn't just a string.
Why not store them as integers? Representing dates is a UI responsibility
Re: Prefer strict tables in SQLite
#105Yeah my DB is the one place I want strict types. Well also RPCs. But SQLite is a somewhat different set of use cases, so maybe I'd understand https://sqlite.org/flextypegood.html more if I were using it. Like there's a point about random scripts not made for SQLite happening to work with it, which isn't normally a consideration for other DBMSes.
> https://sqlite.org/flextypegood.html Both the advantages and disadvantages section is missing key arguments. Key argument in favor of flexible typing: Easy to evolve schema. When you are using SQLite to store data in your embedded database and your requirements change, do you want to create a new database and migrate data each time? Evolving the schema in-place is much easier, and if your application is the only on…
Re: Prefer strict tables in SQLite
#106Too many people missing the point entirely and wanting to make SQLite Postgres or Oracle.
First time I used it was in high school, when I was a newbie to C and didn't know how to link in libraries, and SQLite was the only thing that offered all the code as a single .c file https://sqlite.org/amalgamation.html
Re: Prefer strict tables in SQLite
#107I'd like to see STRICT as the default. That's pretty much the only disagreement with the SQLite developer, who is an amazing guy that wrote an amazing tool!
Re: Prefer strict tables in SQLite
#108Re: Prefer strict tables in SQLite
#109I really hate this trend of turning every piece of software into this kafkaesque monstrosity that demands you jump through 100 hurdles to do the simplest thing. I mean yeah its good for LLMs but as a human it gets kind of annoying. I honestly love that if you hand SQLite garbage it will do its best.
Re: Prefer strict tables in SQLite
#110Earlier quoted context omitted.
Someone should fork it in Rust using Claude and rename it SQRite. Strict type all the things.
A large portion of the tests are closed source unfortunately which would make it tough to create a port.
Why did they do that? Is it owned by a private company?