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

Postgres 9.2 I quote Andrew Dunstan on the pgsql-hackers list: At some stage there will possibly be some json-processing (as opposed to json-producing) functions, but not in 9.2. Doesn’t prevent him from providing an example implementation in PLV8 that should solve your problem. (Link is dead now, see modern PLV8 instead.) Postgres 9.3 Offers an … Read more

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

You can prevent future connections: REVOKE CONNECT ON DATABASE thedb FROM public; (and possibly other users/roles; see \l+ in psql) You can then terminate all connections to this db except your own: SELECT pid, pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = current_database() AND pid <> pg_backend_pid(); On older versions pid was called procpid so you’ll have … Read more