Re: JSON for PG 9.2 - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: JSON for PG 9.2
Date
Msg-id 4EE764C8.3020404@dunslane.net
Whole thread Raw
In response to Re: JSON for PG 9.2  (Greg Smith <greg@2ndQuadrant.com>)
List pgsql-hackers

On 12/13/2011 09:11 AM, Greg Smith wrote:
> On 12/13/2011 08:44 AM, Robert Haas wrote:
>> Rather, I think the point is that embedded Javascript is *extremely* 
>> popular, lots and
>> lots of people are supporting it, and we ought to seriously consider
>> doing the same.  It's hard to think of another PL that we could add
>> that would give us anywhere near the bang for the buck that Javascript
>> would.
>
> Quite.  I hate Javascript with a passion, wish it would just go away 
> and stop meddling with my life.  And even with that context, I think 
> in-core PL/V8 would be a huge advocacy win.  PostgreSQL has this great 
> developer-oriented PL interface, it just doesn't work out of the box 
> with any of the "pop" languages right now.
>
> Personal story on this.  When my book came out, I was trying to take 
> the #1 spot on Packt's bestseller list, even if it was just for a 
> day.  Never made it higher than #2.  The #1 spot the whole time was 
> "jQuery 1.4 Reference Guide", discussing the most popular JavaScript 
> library out there.  And you know what?  Over a year later, it's *still 
> there*.  At no point did it over drop out of that top spot.  The 
> number of people who would consider server-side programming suddenly 
> feasible if PL/V8 were easy to do is orders of magnitude larger than 
> the current PostgreSQL community.


I think your passion is probably somewhat misdirected. I've long thought 
JS would be a good fit for Postgres. It's naturally sandboxed and its 
type system fits ours quite well. And, as you say, it's massively 
popular and getting a major second wind thanks to things like JQuery, 
Ext-JS and node.js. This last one has certainly convinced lots of people 
that JS is not just for browsers any more.

Having said that, don't underestimate the complexity of trying to build 
in PLV8. In its current incarnation the interface is written in C++ (and 
of course so is the underlying V8 engine). I have been doing some 
development work for it, even though my C++ is rather rusty (that's an 
understatement, folks), which is why I haven't got a lot more done - I'm 
just having to go slowly and with reference books by my side. So either 
we'd need to rewrite the glue code entirely in C (and it's littered with 
C++isms) and handle the difficulties of embedding a C++ library, or we'd 
have a major new build infrastructure dependency which could well give 
us a major case of developmental indigestion.

cheers

andrew


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: JSON for PG 9.2
Next
From: Noah Misch
Date:
Subject: Re: foreign key locks, 2nd attempt