News for hackers. Stuff that matters.
Re:PostgREST by dathinab on Sunday November 03, 2019 @03:12PM (#21436268)
Yes, but the constrains sql has wrt. how you represent certain datatypes can lead to problems. Sure in postgres you can fix that by a variety of compound types, and fully new types implemented as pg extension, which can scare people of.

Still there are a tone of applications for which just the basic types are good enough and the server is just a thin wrapper.

In the end the main requirement for efficiency using it is you skill with not basic SQL/plpgSQL (stored procedure, trigger functions, views and knowledge about the effects of the used isolation level). All well documented in postgres.

Re:PostgREST by striking on Sunday November 03, 2019 @03:20PM (#21436311)
> In the end the main requirement for efficiency using it is you skill with not basic SQL/plpgSQL

Another way I've heard this phrased is "It's much easier to hire JS devs than PL/pgSQL devs."

Re:PostgREST by bni on Monday November 04, 2019 @05:40AM (#21440404)
Yes, this is the true reason why these elegant solutions don't see so much adoption.

Worse is better. Cheap JS devs to solve everything with heaps of imperative code is cheaper than elegant solutions.

Even long term this is true. Tech debt with code that people can understand and modify is cheaper than tech debt with an elegant DSL that require learning and mental ability beyond if then else.

Re:PostgREST by yen223 on Sunday November 03, 2019 @04:29PM (#21436746)
There's a postgres extension called plv8 that essentially allows one to write database functions in JavaScript, instead of plpgsql.
Re:PostgREST by striking on Sunday November 03, 2019 @04:33PM (#21436777)
Oh, absolutely. Same with Python, Tcl, Perl... but that's not the part I'm talking about. The business logic being encoded as pgpl/* is just fine. But having to write complex triggers that wrap pgpl functions and making sure the state of the functions is as expected and all of the other wiring stuff is just not something most people are used to.

I've recently seen an uptick in "Postgres-native" stuff being built, though. So maybe there's hope for the future.

Re:PostgREST by ruslan_talpa on Sunday November 03, 2019 @03:20PM (#21436318)
what do datatypes have to do with this. For both PostgREST and any other api layer the situation is the same. The data sits in the db/tabes (so both parties are restricted to the types available in pg) and on the other end you need to output json. The fact that you can have some "smart" internal datatypes in other api layers has 0 advanteges, both systems have to basically take data from the db and display it as json, the intermediate types are irelevant
Re:PostgREST by ruslan_talpa on Sunday November 03, 2019 @03:23PM (#21436330)
you can write your stored procedures in JS of Python if you don't like plpgsql that much :)