Skip to content

Instantly share code, notes, and snippets.

@kousu
Created July 21, 2014 22:14
Show Gist options
  • Save kousu/e3b33b0485fa2879bff5 to your computer and use it in GitHub Desktop.
Save kousu/e3b33b0485fa2879bff5 to your computer and use it in GitHub Desktop.
hacking postgres
-- 1) run postgres
-- 2) load this into it (if postgres wasn't compiled with python support, bad things will happen)
CREATE LANGUAGE plpython2u;
DROP FUNCTION IF EXISTS b();
CREATE FUNCTION b() RETURNS void AS $$
print "HATCH HATCH HATCH"
print plpy
import IPython
IPython.embed()
$$ language plpython2u;
-- 3) go look at the postgres server stdout; this line drops the postgres server into an IPython shell
SELECT * from b();
@kousu
Copy link
Author

kousu commented Jul 21, 2014

I'm not saying this is a /good/ idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment