frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Prefer Strict Tables in SQLite

https://evanhahn.com/prefer-strict-tables-in-sqlite/
70•ingve•1h ago

Comments

tehlike•56m ago
It really should be default, but it isn't due to backward compatibility (i assume).
poidos•48m ago
It’s a stated [0] goal of the project:

> SQLite strives to be flexible regarding the datatype of the content that it stores.

[0]: https://sqlite.org/stricttables.html

tuvix•48m ago
I’m kind of curious why the decision to have implicit casting like this was made in the first place. I can’t think of a single upside other than not having to type out cast(foo as bar)
pstuart•38m ago
IIRC, the project started out as TCL code and it carried that vibe through to what it is today.
notRobot•36m ago
SQLite docs: The Advantages Of Flexible Typing: https://sqlite.org/flextypegood.html
rogerbinns•18m ago
SQLite was originally started as a local database library for use during development for times when the main networked database was not available. It used dbm as the underlying storage mechanism, with the dbm API roughly being string keys with string values. ie all underlying values were actually stored as strings. The SQLite code would automatically do conversions - eg the plus operator would convert the strings to int or float, add them, and generate a stringified number as a result. The vast majority of implementation code did not have to care about types, and very local decisions could be made such as in the addition example.

TCL was used as a dev wrapper language at the time, and it functioned the same way.

It was only in mid-2004 that SQLite 3 was released which used its own storage backend, and that allowed for the 5 supported storage types (int64, string, bytes, float, null). It was API compatible (with minor adjustments) with the earlier SQLite 2, so the lack of static typing continued, otherwise everyone would have to rewrite their code. You do get dynamic typing, which hasn't been a problem for the vast majority of SQLite users.

Do remember that SQLite is competition for fopen, not Oracle / Postgres etc. It is trying to make things as effective as possible in that scenario. If you don't want numbers in your string column, then don't do that!

cdmckay•46m ago
I would’ve thought this was the default.
itsthecourier•35m ago
about the use of ANY, that's perfect for tracking changes on an audit table per field
jll29•32m ago
I'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!

mort96•22m ago
Yeah it's a really weird design decision. Why would I want the database to let me accidentally insert the wrong type? SQLite is mostly great but its philosophy towards type safety leaves something to be desired. I once had to clean up in a project where someone had accidentally stored the strings '1' and '0' in a Boolean column in code deployed to thousands of devices; not fun.

Another thing I dislike is the lack of timestamp types. Instead, you're expected to just use a text column and store a textual timestamp. Even worse, instead of using ISO, the standard date time functions produce strings on the form "yyyy-mm-dd HH:MM:SS" which you're just supposed to assume are in UTC. Why not at least give us "yyyy-mm-ddTHH:MM:SSZ"? Or, you know, a proper space efficient timestamp data type.

A truly great project, with some truly baffling design decisions.

simonw•17m ago
SQLite very rarely changes defaults because of their commitment to backwards compatibility. They don't want software written against SQLite 3.53 to suddenly start throwing errors when upgraded to 3.54 because suddenly `CREATE TABLE` is creating strict tables and the rest of the software breaks as a result.
Eswo•25m ago
really interesting, thanks
moron4hire•19m ago
Using Entity Framework, this doesn't come up as a particular issue, but I still wish it were strict by default because I expect there could be some performance optimizations made for de/serialization.
blixt•17m ago
I 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.

petilon•17m ago
The downside of strict tables is that some data types are not available, such as Date.

Strict should really be the default. If a database is shared by multiple applications then you should be able to rely on the declared data type. If one application stores a string into a numeric column that breaks everyone else.

On the other hand, the main use case for SQLite is embedded databases. And that means only one application is using the database. In that scenario being able to evolve the schema (as opposed to creating a new database and copying the data over) can be seen as an advantage. The application's code knows what to expect in each column--including mixed data types.

Ciantic•10m ago
SQLite has no date data type. Also SQLite has no way to call EXPLAIN on query and get the dummy type name either for arbitrary SELECT query, so you can't even infer it, if you were to use the dummy type name "DATE" or "DATETIME".

Prefer Strict Tables in SQLite

https://evanhahn.com/prefer-strict-tables-in-sqlite/
71•ingve•1h ago•17 comments

How to Hide from Killer Drones

https://www.economist.com/science-and-technology/2026/07/08/how-to-hide-from-killer-drones
37•pseudolus•1h ago•17 comments

Who manages the agents?

https://www.off-policy.com/dont-go-quietly-into-the-ai-night/
29•GavCo•1h ago•14 comments

We scaled PgBouncer to 4x throughput

https://clickhouse.com/blog/pgbouncer-clickhouse-managed-postgres
122•saisrirampur•4h ago•15 comments

The early History of the Singular Value Decomposition (1993) [pdf]

https://www.math.ucdavis.edu/~saito/courses/229A/stewart-svd.pdf
57•wolfi1•4h ago•21 comments

Modern decor may be straining people's brains

https://studyfinds.com/modern-decor-may-be-straining-peoples-brains/
113•downwithdisease•3h ago•95 comments

Nvidia, CoreWeave, and Nebius: Inside the Circular Financing of the GPU Boom

https://io-fund.com/ai-stocks/nvidia-coreweave-nebius-circular-financing-gpu-boom
34•adletbalzhanov•2h ago•7 comments

Leaded Gas Was a Known Poison the Day It Was Invented (2016)

https://www.smithsonianmag.com/smart-news/leaded-gas-poison-invented-180961368/
90•downbad_•2h ago•54 comments

AI Can't Recreate the Thrust Game (But It Can Help You Understand It)

https://www.jamesdrandall.com/posts/thrust_ai_powered_software_archaeology/
25•msephton•21h ago•16 comments

UPI: Anatomy of a Payment Transaction

https://timeseriesofindia.com/economy/reads/upi-architecture/
18•prtk25•2h ago•3 comments

Sixtyfour (YC P25) Is Hiring

https://www.ycombinator.com/companies/sixtyfour/jobs/bIbgQkL-operations-associate-data-samples-cu...
1•HPMOR•2h ago

Biff.graph: structure your Clojure codebase as a queryable graph

https://github.com/jacobobryant/biff/tree/v2.x/libs/graph
43•jacobobryant•4d ago•0 comments

Female US rower completes historic solo journey from California to Hawaii

https://www.theguardian.com/us-news/2026/jul/04/california-hawaii-rowing-solo-journey
103•speckx•2h ago•27 comments

Show HN: Learn by rebuilding Redis, Git, a database from scratch

https://shipthatcode.com
52•acley•5h ago•21 comments

Show HN: Orbit – AR satellite tracker, watch 15k+ objects

https://nagylukas.github.io/orbit.html
13•lukas9•2h ago•2 comments

Einstein's relativity rules chemical bonds in heavy elements, new research shows

https://www.brown.edu/news/2026-07-09/chemical-bonds-relativity
363•hhs•21h ago•161 comments

Reverse centaurs are the answer to the AI paradox

https://pluralistic.net/2025/09/11/vulgar-thatcherism/#there-is-an-alternative
41•jason_s•2h ago•9 comments

Amber the programming language compiled to Bash/Ksh/Zsh

https://amber-lang.com/
30•_superposition_•4d ago•18 comments

BLISS

https://en.wikipedia.org/wiki/BLISS
28•tosh•2h ago•5 comments

Google Search lets creators know more about their reach

https://www.theverge.com/tech/961955/google-search-console-reach-platform-properties
79•herbertl•3d ago•37 comments

Show HN: Earth Game – An offline CLI for turning life goals into quests

https://github.com/skorotkiewicz/earth-game
8•modinfo•2h ago•1 comments

Show HN: Reame – a CPU inference server that gets faster as it runs

https://github.com/swellweb/reame
9•targetbridge•3h ago•2 comments

Apple sues OpenAI, accuses ex-employees of stealing trade secrets

https://9to5mac.com/2026/07/10/apple-sues-openai-trade-secret-theft/
1485•stock_toaster•22h ago•825 comments

Book: RISC-V System-on-Chip Design

https://www.amazon.com/RISC-V-Microprocessor-System-Chip-Design/dp/0323994989
76•xlmnxp•2d ago•30 comments

Digital Deli, 1984 book by early PC hackers and enthusiasts

https://www.atariarchives.org/deli/
30•achairapart•3d ago•2 comments

Earendel (Astronomical Object)

https://en.wikipedia.org/wiki/Earendel_(astronomical_object)
23•brainlessdev•2h ago•4 comments

Speculations Concerning the First Ultraintelligent Machine (1965) [pdf]

https://languagelog.ldc.upenn.edu/myl/Good1964.pdf
79•zetalyrae•5h ago•38 comments

Otary – Image and Geometry Python Library Now Has Tutorials

https://alexandrepoupeau.com/otary/learn/
81•poupeaua•3d ago•1 comments

An update on residential proxies and the scraper situation

https://lwn.net/SubscriberLink/1080822/990a8a5e2d379085/
303•chmaynard•23h ago•303 comments

SpaceX wants to launch 100k more Starlink satellites for 100x the bandwidth

https://www.zdnet.com/home-and-office/networking/spacex-wants-to-launch-100000-more-starlink-sate...
280•CrankyBear•1d ago•1016 comments