How do I query using fields inside the new PostgreSQL JSON datatype?

I am looking for some docs and/or examples for the new JSON functions in PostgreSQL 9.2. Specifically, given a series of JSON records: [ {name: “Toby”, occupation: “Software Engineer”}, {name: “Zaphod”, occupation: “Galactic President”} ] How would I write the SQL to find a record by name? In vanilla SQL: SELECT * from json_data WHERE … Read more

Postgresql – unable to drop database because of some auto connections to DB

Whenever I try to drop database I get: ERROR: database “pilot” is being accessed by other users DETAIL: There is 1 other session using the database. When I use: SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname=”TARGET_DB”; I terminated the connection from that DB, but if I try to drop database after that somehow someone automatically connects … Read more