News for hackers. Stuff that matters.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by lugus35 on Thursday January 07, 2016 @10:44AM (#10858505)
With a REST layer like https://github.com/begriffs/postgrest you don't need any extra application server layer to serve your data, securely (RLS). Bye bye Java EE ?
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by reitanqild on Thursday January 07, 2016 @02:34PM (#10860138)
You just got an accidental downvote as I came back after bookmarking your link. Sorry.

Dang/mods: Can we please please get something to avoid accidentally downvoting good stuff on mobile phones?

Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by danieltillett on Thursday January 07, 2016 @03:22PM (#10860469)
Happens all the time and has been the most requested feature of all time. I like to take the charitable view and say the current design is there to let your ego explain away down votes - i.e. I am only being down voted by accident, not my post is terrible.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by mdellabitta on Thursday January 07, 2016 @05:15PM (#10861236)
That feature is included with every new account!
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by saidajigumi on Thursday January 07, 2016 @03:03PM (#10860321)
It's especially bad on mobile, but desktop can be a problem too. I know I've misclicked a downvote on rare occasion, to my regret.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by spacemanmatt on Friday January 08, 2016 @08:13AM (#10864587)
I gotta plug OpenRESTy at this point. It's based on Nginx, and it's really easy to work with. It is my go-to REST solution for PostgreSQL.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by rodionos on Friday January 08, 2016 @12:35PM (#10866598)
It's not going to be as easy as you make it sound - getting rid of the application tier. Think of all the goodness that the Spring framework provides, for example. Do you anticipate all the modules will be taken over by a database?
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by scardine on Thursday January 07, 2016 @11:55AM (#10859022)
Postgrest has a very clever design. I want to see other tools going this route.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by saosebastiao on Thursday January 07, 2016 @12:54PM (#10859482)
It would be kinda cool to find a way to stuff a fast HTTP server into Postgres and run it all directly from the Postgres process serving the request.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by dc2447 on Thursday January 07, 2016 @12:59PM (#10859516)
There is an nginx module for this.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by nickpeterson on Thursday January 07, 2016 @09:02PM (#10862393)
People seem to dislike this because they want separate components in order to 'scale out', but honestly, having the option for most trivial applications would be extremely nice. Even more so when you consider Postgres supports routines written in non-sql programming languages.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by leeoniya on Thursday January 07, 2016 @06:23PM (#10861615)
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by bdcravens on Thursday January 07, 2016 @12:42PM (#10859386)
I looked at Postgrest, and it was a little more opinionated re URLs and associations than I would have preferred.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by brunoqc on Thursday January 07, 2016 @12:48PM (#10859437)
I'm not that familiar with REST. Care to explain what you mean?
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by Pxtl on Thursday January 07, 2016 @08:15PM (#10862218)
REST just mean exposing your business object via HTTP verbs. In addition to the normal Get and Post http verbs used by your browser, there's also Delete and Put. Put is effectively equivalent to an Upset command, so with Get, Put, and Delete you've got all the operations to manage an object (create/read/update/delete), with Post for special procedures.

Those also obviously correspond to the Insert/update/select/delete SQL operations.

So hooking a RESTful interface direct to your db lets JavaScript on the client talk directly to the database via an http server with no business layer in between. It's obviously a nifty workflow for the "JavaScript all the things" developer.

That said, I think restfulness is a bit of a fad tied to the popularity of javascript-everything. But it has created a limited, simple standard for http services, so that's nice.

Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by brunoqc on Thursday January 07, 2016 @08:41PM (#10862323)
Thanks but I was referring to what the person meant by saying that something was not like he would have preferred.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by topspin on Thursday January 07, 2016 @10:24PM (#10862723)
Postgrest deviates from some REST URL conventions that REST users are familiar with. As an example, one very common convention gives each item a distinct path with the 'id' (the primary key of some table, typically) as the last path element: /some_path/123. Notice that the 'key' column name is implied and simple (not compound).

Postgrest does not adopt this convention. This decision is not arbitrary, however. Postgrest is conceptually a function that computes a REST API for a PostgreSQL database, and tables in a PostgreSQL can (for better or worse) have compound primary keys, which do not map well to a simple URL path. So Postgrest uses a more general URL syntax. The equivalent of the above is: /some_path?id=eq.123.

Postgrest represents some novel thinking about the use of certain HTTP verbs as well. A lot of this is discussed in the Postrest introduction video here: http://postgrest.com/

Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by gnaritas on Friday January 08, 2016 @03:22AM (#10863635)
> Postgrest deviates from some REST URL conventions that REST users are familiar with.

Those are common API conventions, but they have nothing to do with REST; REST only requires unique URI's for resources, it has nothing to say about the format of those URI's. The Postgres version does not deviate from REST, it deviates from a popular API pattern, that's all.

Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by bdcravens on Friday January 08, 2016 @11:38AM (#10866110)
I like the idea of REST as a language-agnostic datasource; adhering to conventions facilitates this.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by gnaritas on Friday January 08, 2016 @01:07PM (#10866838)
If you're actually doing REST, the URI convention is irrelevant since you won't be constructing URI's to being with, but following the URI's given to you by previous entry points. Actual REST requires you follow links, not construct them. So having well defined URI conventions like above actually harm the REST API be encouraging API clients to construct links manually rather than use the links given to them and it hurts the API by not allowing the server to change the URI structure over time because clients become bound to a particular format. Those conventions are harmful under the principles of REST as they encourage tight coupling and prevent change. URI's are not supposed to matter for a reason, REST is supposed to be hypermedia, i.e. follow links, don't build them.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by dragonwriter on Friday January 08, 2016 @12:12PM (#10866413)
REST specifically rejects the need for URL conventions because HATEOAS. If URL conventions matter -- i.e., if resource identifiers are communicated out-of-band rather than client and server being decoupled by way of resource identifiers being communicated in-bamd through hypermedia -- what you are doing is not REST, but instead exactly the problem for which REST is the solution.
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by terrorblade on Friday January 08, 2016 @12:12PM (#10866414)
noob here .. if the database is in charge of serving rest, where does the business logic go? am i right in thinking that this would eliminate the need for a django/express?
Re:PostgreSQL 9.5: UPSERT, Row Level Security, and Big Data by lkjaero on Saturday January 09, 2016 @01:24AM (#10870326)
The database stores the data, the rest API handles the business logic. Django has multiple plugins for providing a REST API, such as Tastypie. http://tastypieapi.org/ With this, django is the API. A rest API is good for when you want to share data between multiple clients (eg a website and mobile apps) and want to have more complicated business logic than the database can provide by itself.