News for hackers. Stuff that matters.
Re:Stochastic gradient descent written in SQL by bob1029 on Tuesday March 07, 2023 @01:23PM (#35059017)
> Databases are much more powerful than we think

The older I get the more I agree with this.

There is nothing you cannot build by combining SQL primitives. Side effects can even be introduced - on purpose - by way of UDFs that talk to the outside world.

I've seen more than one system where the database itself was directly responsible for things like rendering final HTML for use by the end clients. You might think this is horrible and indeed many manifestations are. But, there lurk an opportunity for incredible elegance down this path, assuming you have the patience to engage in it.

Re:Stochastic gradient descent written in SQL by giraffe_lady on Tuesday March 07, 2023 @02:16PM (#35059815)
> I've seen more than one system where the database itself was directly responsible for things like rendering final HTML for use by the end clients.

I did this for a side project a few months ago and even used postgrest to serve the page with correct headers for html. It felt simultaneously really cursed and obvious. Shit you could even use plv8 to run mustache or whatever in the db if you really wanted to piss people off.

Re:Stochastic gradient descent written in SQL by dventimi on Tuesday March 07, 2023 @03:26PM (#35060699)
I'm doing this right now with a DO droplet built with PostgreSQL, postgrest, nginx, and not much else. Do you have any tips, tricks, or blog posts you can share based on your experience? You should post it to HN. Strike while the iron's hot. With a little luck you'll hit the front page.
Re:Stochastic gradient descent written in SQL by giraffe_lady on Tuesday March 07, 2023 @05:13PM (#35062015)
Nah nothing that refined. Pretty predictably supabase is doing some weird stuff along these lines and I found some abandoned and semi-active repos associated with them and people working for them that were useful examples of some things.

As for posting to HN absolutely no thanks. These people are so fucking hostile there is no accomplishment too small to tear apart for entertainment here. I have no interest in it.

Re:Stochastic gradient descent written in SQL by dventimi on Tuesday March 07, 2023 @05:44PM (#35062366)
> As for posting to HN absolutely no thanks. These people are so fucking hostile there is no accomplishment too small to tear apart for entertainment here. I have no interest in it.

You make a really good point.

Re:Stochastic gradient descent written in SQL by kiwicopple on Wednesday March 08, 2023 @06:15AM (#35067655)
disclosure: supabase ceo

plv8 doesn't have network access, but this can be done with PostgREST.

That said, we actually restricted the HTML content-type on our platform so that users cannot do this. This is because we don't want to get too deep into the "frontend" world, with ever-changing frameworks.

We've found that if we offer a small feature, our users demand feature-completeness. In this case we're better-off waiting until we have solve a few of the major database tasks (branching + migrations, scale-to-zero, edge caching, etc)

FWIW, I think it's very cool serving HTML through PostgREST. I would be pretty happy to do this personally

Re:Stochastic gradient descent written in SQL by dventimi on Wednesday March 08, 2023 @12:32PM (#35072020)
disclosure: Supabase user

Long time user, first time caller. Besides the DO droplet, separately I also use Supabase and I love it.

I understand completely about restricting the content type, maybe just for now. Fun fact: I work around it by serving up text/xml plus XSLT. I'm sure you don't mind.

Re:Stochastic gradient descent written in SQL by kiwicopple on Thursday March 09, 2023 @12:01AM (#35078460)
> I work around it by serving up text/xml plus XSLT. I'm sure you don't mind.

Not at all, I hear "application/xhtml+xml" is a nice hack from some of the team

Re:Stochastic gradient descent written in SQL by Foobar8568 on Wednesday March 08, 2023 @02:07AM (#35066119)
This PL/SQL Overlord is running banks https://www.avaloq.com/solutions/products/avaloq-core
Re:Stochastic gradient descent written in SQL by CRConrad on Thursday March 09, 2023 @02:03PM (#35085174)
> Side effects can even be introduced - on purpose - by way of UDFs that talk to the outside world.

> I've seen more than one system where the database itself was directly responsible for things like rendering final HTML for use by the end clients.

I built BI Web pages entirely in PL/SQL (using some Oracle modules I can't quite recall the nams of) over twenty years ago. Got a bit hairy to keep the meta-recursive stuff in your head when hard-coding JavaScript into it, calling the next such page for each value on the page, for drill-down to the next level... Not fun, but quite doable.

And with a bit more modern tooling -- as I said, this was turn-of-the-century tech -- I have no doubt it could be done much more effectively and efficiently nowadays.