Hacker News new | past | comments | ask | show | jobs | submit login

How would you fix WebSQL? Writing a from-scratch implementation of SQLite seems like the only option, and I don't think Mozilla had the resources for that at the time.

I agree the situation sucks, but I'm not sure how to fix it even today.

Like I said, I'm not sure this was a winnable fight. And yes, writing a good DB implementation from scratch is really, really hard. But...

First, keep in mind that lot of this decision was political; if Mozilla had lobbied for it a lot of fudging could have been done. Instead Mozilla made sure that a strict reading of the rules was used by which, yes, WebSQL clearly failed.

And no, Mozilla probably didn't have the resources to implement SQLite from scratch, but:

1. They could have worked with others. Apple, quite clearly, was much more invested in WebSQL than IndexedDB. Could they have contributed to a join effort? We'll never know.

2. In particular, the rule about needing two seperate implementations is good, but it could have been fudged here; a bigger problem was the lack of a spec beyond "whatever Sqlite does". Did Mozilla have the resources to clearly specify how a reference implementation should work, even if the only actual implementation remained Sqlite? Maybe. Would that have been enough? Arguably.

3. In the event, IndexedDB was not a real replacement for WebSQL; at most it was an important tool that could be used to build one, some day; a process that is still ongoing (eg, with PouchDB) and has no real end in site. Even if we lacked the resources to really bring WebSQL up to par and re-implement Sqlite from scratch, we apparently lack the resources to bring IndexedDB up to par too. If we're doomed to spend years struggling with broken implementations and poor browser support either way, what did we gain with IndexedDB?

Like I said, I don't know that there was a good solution to this. But I feel like Mozilla helped ensure we got a bad one.

I guess I just disagree that it would have been good for Mozilla to fudge the standardization rules.

The rule of having multiple implementations is an important one.

And it might have been possible - surely Google and Microsoft, who supported IndexedDB, had the resource to write an alternative implementation. I don't know the history enough to know why they didn't.

I think I'm more cynical about the process than you are. From my point of view, the process has been intensely political from day one, with rules honoured mainly in the breach.

The best retelling of events, I think, is this one: http://nolanlawson.com/2014/04/26/web-sql-database-in-memori...

Has some very good details. And it's certainly funny to see what was said during the discussion with how things turned out in practice.

Edit: I'd sum it up as "Google and Apple argue for a solution that will work on mobile; Mozilla and Oracle don't care about mobile, are weirdly obsessed with the idea that developers hate SQL, and use political manoeuvring to win the fight". (Oracle's role in this seems especially odd, but perhaps they had some longer term strategy in mind.) In any case, in retrospect ignoring mobile was a bad idea, and ditching SQL seems to have had no real benefit.

That's a very misleading summary. Mozilla is rather clear that they don't want to spec on a specific version of SQLite. The one thing that is weird is Mozilla saying that developers want "anything but SQL", which sounds like BS. But even if they were in agreement that SQL was great, the simple fact that there's no independent implementations of SQLite 3.6.whatever's SQL dialect is good enough reason to not make it a standard.

It does show the total need for a fast, JITable intermediate language, and the silliness in not having one from the start, or at least long, long ago.

> Mozilla is rather clear that they don't want to spec on a specific version of SQLite

Not entirely true either. From the link:

> Hixie has said before he’s willing to fully spec the SQL dialect used by [WebSQL]. But since Mozilla categorically refuses to implement the spec (apparently regardless of whether the SQL dialect is specified), he doesn’t want to put in the work since it would be a comparatively poor use of time.

It's clear in the email thread that the "spec" world just be codifying exactly what that version of SQLite did. It's not likely they'd pick an existing SQL dialect that's compatible with SQLite, or they'd be essentially limited to that version of SQLite. Result is that you'd end up with the same problem and things would not really be compatible.

Even in that article, the a dev says he's queried the SQLite version in order to detect which exact FT options are available.

The argument for it is basically "eh but it's handy", ignoring the idea of the Web.

You didn't quote Jonas' or roc's responses to that specific claim.

I didn't feel the need; it just brings the discussion back to my earlier comment upthread.

If you don't want to just use Sqlite (understandable), and you don't want to write something that is as good as Sqlite (also understandable), then you're going to have a crap database implementation. There's just not a lot of other options there. Jonas' comment just reiterates the lack of choices.

But given the three bad choices, the question does arise: Was IndexedDB really the best of a bad lot? In 2009, a lot of very optimistic things were said about IndexedDB performance, adoption, usage on mobile, developer acceptance. It's been 6 years, and I think it's safe to say that IndexedDB hasn't lived up to anyone's hopes.

Clearly it was dumb for people at Mozilla to take a bullet for Microsoft. But no matter -- I'm curious why you can't see past that and (also) hold Microsoft to account for rejecting WebSQL.

One thing I never understood is why there needed to be a second implementation of WebSQL. SQLite is public domain, any browser vendor can choose to embed it in what they ship.

It's a standards process requirement. A standard must have a well-written spec, well-written enough that multiple implementations are possible. Showing multiple implementations that are compatible is enough to prove that.

When there is just a single codebase, even if it is open source, it isn't a standard. Now, not everything needs to be a standard, but on the web standardization is a big part of why it is so successful.

One example of why a single codebase is bad: Imagine that SQLite version X is the implementation of WebSQL, which all browsers must use. SQLite development is of course continuing, fixing security issues and making it faster, etc. Will browsers just keep using SQLite past version X? What if the SQLite community takes SQLite in a direction that isn't optimal for web browsers? Perhaps web browsers will fork it. What if browsers end up not agreeing on the fork, and some use the original project, and others use the fork - or there are multiple forks?

All of that makes it very risky that compatibility issues will appear between browsers. Having a properly specced standard, with multiple compatible implementations, is so far the best way that we have found that can prevent such things.

More succinctly: SQLite version whatever is specified only by its C source code, and C is woefully underspecified. Lots of Undefind Behavior on top of the memory-unsafe codebase itself. This is not a specification from which two independently implemented interoperable implementations could be written. Ergo, not a standard.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact