psycopg2 craziness

Chris Angelico rosuav at
Fri Feb 22 07:22:36 CET 2013

On Fri, Feb 22, 2013 at 10:27 AM,  <andydtaylor at> wrote:
>>>> cursor_to.execute("CREATE TABLE foo (id serial PRIMARY KEY);")

Like many things, it's silent when everything works. As MRAB
suggested, you probably need to commit before the changes become
visible; unlike certain other database engines, PostgreSQL actually
provides transactional integrity for DDL queries (CREATE/DROP TABLE
etc) as well as DML queries (INSERT/UPDATE etc). This is incredibly
handy, but can be surprising if you're accustomed to them being
immediately visible to other sessions.

But next time you ask for help, don't say that you're "having issues"
- say *what* issues you're having! It makes helping you so much easier
if we know up front what you need help with, rather than being forced
to guess :)

(By the way, does anyone else see irony in there being "craziness" in
a module that's pretty much called "psycho"?)


More information about the Python-list mailing list