473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Segmentation fault on updating a BYTEA field [psycopg2]

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

Table "public.duplicate"
Column | Type | Modifiers
----------+-------+-----------
sig | bytea | not null
orig_sig | bytea | not null
Indexes:
"duplicate_pkey" PRIMARY KEY, btree (sig)
"ix_duplicate_orig_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_string = ...
conn = psycopg2.connect(connect_string)
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\xcc\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
Jun 27 '08 #1
1 2141
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.duplicate"
Column | Type | Modifiers
----------+-------+-----------
sig | bytea | not null
orig_sig | bytea | not null
Indexes:
"duplicate_pkey" PRIMARY KEY, btree (sig)
"ix_duplicate_orig_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_string = ...
conn = psycopg2.connect(connect_string)
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\xcc\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
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
4
by: Abandoned | last post by:
Hi.. I run a my script and 3-4 minutes later give me an error "segmentation fault". What is the reason of this error ? I use in my script: Threading Psycopg2 open & write to txt urlopen
0
by: badaboum84 | last post by:
I have to migrate a current PostgreSQL database to MSSQL. For doing this task I uses Python to create script for doing this task. Now, I want to extract the data from the current PostgreSQL...
15
by: Rares Vernica | last post by:
Hello, I have a strange problem. I compile my code with g++ (GCC) 4.1.2. My code runs just fine if I use the -O2 optimization flag. valgrind does not report any memory leak. When I use the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.