Segmentation fault on updating a BYTEA field [psycopg2]

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • George Sakkis

    Segmentation fault on updating a BYTEA field [psycopg2]

    I have a simple DB table that stores md5 signature pairs:

    Table "public.duplica te"
    Column | Type | Modifiers
    ----------+-------+-----------
    sig | bytea | not null
    orig_sig | bytea | not null
    Indexes:
    "duplicate_pkey " PRIMARY KEY, btree (sig)
    "ix_duplicate_o rig_sig" btree (orig_sig)

    I use SqlAlchemy to interact with it and inserting works fine; update
    however crashes hard with a segfault. Sure enough, the crash is
    reproducible when using the underlying psycopg2 directly:
    >>import psycopg2
    >>connect_strin g = ...
    >>conn = psycopg2.connec t(connect_strin g)
    >>cur = conn.cursor()
    >>cur.execute(' SELECT sig,orig_sig from duplicate limit 1')
    >>d = cur.fetchone()
    >>d
    (<read-only buffer for 0x40209100, size 16, offset 0 at 0x403054e0>,
    <read-only buffer for 0x402090f0, size 16, offset 0 at 0x40305580>)
    >>map(str,d)
    ["\x02#qO\xb0\xc c\xfcx\xb9u\xa5 \x83)\xc4'@", '\xa1\xf22\xf6y \xd0\xbc
    \xea6\xf0Y\xf1" \xc9(\n']
    >>cur.execute(' UPDATE duplicate SET orig_sig=%(orig _sig)s WHERE duplicate.sig = %(duplicate_sig )s',
    .... dict(orig_sig=d[0], duplicate_sig=d[1]))
    Segmentation fault

    Am I (and SqlAlchemy) doing something silly or is this a bug in
    psycopg2 ?

    George
  • George Sakkis

    #2
    Re: Segmentation fault on updating a BYTEA field [psycopg2]

    On May 21, 6:32 pm, George Sakkis <george.sak...@ gmail.comwrote:
    I have a simple DB table that stores md5 signature pairs:
    >
    Table "public.duplica te"
    Column | Type | Modifiers
    ----------+-------+-----------
    sig | bytea | not null
    orig_sig | bytea | not null
    Indexes:
    "duplicate_pkey " PRIMARY KEY, btree (sig)
    "ix_duplicate_o rig_sig" btree (orig_sig)
    >
    I use SqlAlchemy to interact with it and inserting works fine; update
    however crashes hard with a segfault. Sure enough, the crash is
    reproducible when using the underlying psycopg2 directly:
    >
    >import psycopg2
    >connect_stri ng = ...
    >conn = psycopg2.connec t(connect_strin g)
    >cur = conn.cursor()
    >cur.execute('S ELECT sig,orig_sig from duplicate limit 1')
    >d = cur.fetchone()
    >d
    >
    (<read-only buffer for 0x40209100, size 16, offset 0 at 0x403054e0>,
    <read-only buffer for 0x402090f0, size 16, offset 0 at 0x40305580>)>>m ap(str,d)
    >
    ["\x02#qO\xb0\xc c\xfcx\xb9u\xa5 \x83)\xc4'@", '\xa1\xf22\xf6y \xd0\xbc
    \xea6\xf0Y\xf1" \xc9(\n']>>cur.execute(' UPDATE duplicate SET orig_sig=%(orig _sig)s WHERE duplicate.sig = %(duplicate_sig )s',
    >
    ... dict(orig_sig=d[0], duplicate_sig=d[1]))
    Segmentation fault
    >
    Am I (and SqlAlchemy) doing something silly or is this a bug in
    psycopg2 ?
    >
    George
    I installed the latest release (psycopg2-2.0.7) and it seems the
    problem is gone. Sorry for the noise.

    George

    Comment

    Working...