News for hackers. Stuff that matters.
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by xtrumanx on Saturday September 27, 2014 @01:54AM (#8376206)
Only problem I have with JSON on Postgres is you can't update a property of a JSON object like so:

    update table set jsonCol->propertyA = 42;
You need to write an extension for that. Easiest to do so using Python but sadly Heroku doesn't support python on postgres since its unsafe.
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by bencollier49 on Saturday September 27, 2014 @04:03AM (#8376416)
Just tried to google this, but couldn't find anything. Why is Python on Postgres considered unsafe?
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by JonnieCache on Saturday September 27, 2014 @05:46AM (#8376581)
Just because its a programming language. It can write to disk, open sockets, etc.

"As of PostgreSQL 7.4, PL/Python is only available as an "untrusted" language, meaning it does not offer any way of restricting what users can do in it. It has therefore been renamed to plpythonu. The trusted variant plpython might become available again in future, if a new secure execution mechanism is developed in Python. The writer of a function in untrusted PL/Python must take care that the function cannot be used to do anything unwanted, since it will be able to do anything that could be done by a user logged in as the database administrator. Only superusers can create functions in untrusted languages such as plpythonu."

http://www.postgresql.org/docs/current/static/plpython.html

Incidentally I've been merging my json in perl. It's automatically built into postgres, and the Hash::Merge library with it's configurable behaviour is very handy. Still, looking forward to not doing that. 9.4 is coming before xmas, right?

Re:PostgreSQL Outperforms MongoDB in New Round of Tests by yangyang on Saturday September 27, 2014 @06:46AM (#8376666)
That's not strictly true; PL/Perl is (obviously) a programming language and is available in trusted (with certain operations disabled) and untrusted variants: see [1].

The issue with PL/Python is that it's nigh on impossible to properly sandbox Python.

[1] http://www.postgresql.org/docs/9.3/static/plperl-trusted.htm...

Re:PostgreSQL Outperforms MongoDB in New Round of Tests by mm_throwaway on Saturday September 27, 2014 @04:00AM (#8376404)
Please correct me if I'm wrong, but isn't updating JSON properties one the big improvements of the soon-to-be-released 9.4 version?
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by rpedela on Saturday September 27, 2014 @08:19AM (#8376819)
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by nl on Saturday September 27, 2014 @05:30AM (#8376549)
Yes this is true, and much needed.
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by Erwin on Saturday September 27, 2014 @04:13AM (#8376438)
Huh. That's a little silly given the venerable HSTORE already has this capability:

      create table foo (d hstore);
      insert into foo (d) values(hstore(ARRAY['key', 'key2'], 
      ARRAY['value', 'value2']));
    --  "key"=>"value", "key2"=>"value2"
      update foo set d = d || hstore('key', UPPER(d->'key'));
    -- "key"=>"VALUE", "key2"=>"value2"
Seems like JSON / JSONB need operators to merge two objects. In fact isn't JSONB sharing the data format with the new HSTORE2?
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by willlll on Saturday September 27, 2014 @03:27PM (#8377936)
You can use PLV8 to do that in javascript on heroku.
Re:PostgreSQL Outperforms MongoDB in New Round of Tests by xtrumanx on Saturday September 27, 2014 @09:51PM (#8378712)
You're right [0]. Thanks for the heads up.

[0] https://blog.heroku.com/archives/2013/6/5/javascript_in_your...