473,395 Members | 1,377 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,395 software developers and data experts.

"another command is already in progress" error (fwd)

I am doing asynchronous sql calls using the postgres C library.
After doing two PQsendQuery() calls, I get the

"another command is already in progress" error.
The two calls I am doing are an update, and then an insert, in that order.
I am doing this for speed, since my program can't afford to wait for the
answer from the first to complete before making the request for the
second.

For some reason this method has started giving the error above, even
though it has been running on the same testing box for its entire
lifecycle and it wasn't before.

My two questions are:

1. Is there a way to get around this error besides doing some kind of busy
loop?

2. Is there a faster way of doing an update/insert than doing two
asynchronous requests? I want it to be as fast as possible. I was doing a
select first, then either an insert or an update depending on the entry
was there, but this method has speeded up our process by about 10x.

Thanks for the help, I've checked the archives, but am a new list member
myself, and hope to get to know postgresql more as time goes on.

Randy

http://www.frenzy.org
"Sed Quis Custodiet Ipsos Custodes?" -Juvenal

This communication (including any attachments) is intended for the use of the intended
recipient only and may contain information that is confidential, privileged or legally
protected. Any unauthorized use or dissemination of this communication is strictly
prohibited. If you have received this communication in error, please immediately notify
the sender by return e-mail message and delete all copies of the original communication.
Thank you for your cooperation.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 11 '05 #1
2 8760
pg***@frenzy.org writes:
I am doing asynchronous sql calls using the postgres C library.
After doing two PQsendQuery() calls, I get the
"another command is already in progress" error.
The two calls I am doing are an update, and then an insert, in that order.
I am doing this for speed, since my program can't afford to wait for the
answer from the first to complete before making the request for the
second.
For some reason this method has started giving the error above, even
though it has been running on the same testing box for its entire
lifecycle and it wasn't before.


I don't think I believe that; that has never been supported.

If you have several commands you'd like to fire off as a batch, you can
put them in a single PQsendQuery (with semicolons between of course).
Then keep reading PGresults until you get a NULL. But you can't issue
another PQsendQuery until you've gotten that NULL.

At least, not on the same connection. I'm not sure opening multiple
connections could be a win for you, but it might be something to think
about.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #2
pg***@frenzy.org writes:
I am doing asynchronous sql calls using the postgres C library.
After doing two PQsendQuery() calls, I get the
"another command is already in progress" error.
The two calls I am doing are an update, and then an insert, in that order.
I am doing this for speed, since my program can't afford to wait for the
answer from the first to complete before making the request for the
second.
For some reason this method has started giving the error above, even
though it has been running on the same testing box for its entire
lifecycle and it wasn't before.


I don't think I believe that; that has never been supported.

If you have several commands you'd like to fire off as a batch, you can
put them in a single PQsendQuery (with semicolons between of course).
Then keep reading PGresults until you get a NULL. But you can't issue
another PQsendQuery until you've gotten that NULL.

At least, not on the same connection. I'm not sure opening multiple
connections could be a win for you, but it might be something to think
about.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 11 '05 #3

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

Similar topics

5
by: Michelle Kinsey-Clinton | last post by:
Hello, I am writing an ASP app which is giving me some very frustrating errors. They appear intermittently, no real pattern to them, and often go away if you reload, or back up a few pages and...
3
by: Roy | last post by:
Anyone have any links and/or code samples demonstrating how this can be done? Current procedure is that john doe clicks an item on a datagrid of mine and after however long, gets the info he wants....
0
by: pgsql | last post by:
I am doing asynchronous sql calls using the postgres C library. After doing two PQsendQuery() calls, I get the "another command is already in progress" error. The two calls I am doing are an...
0
by: frenzy | last post by:
I am doing asynchronous sql calls using the postgres C library. After doing two PQsendQuery() calls, I get the "another command is already in progress" error. The two calls I am doing are an...
6
by: Clément Collin | last post by:
I working on a GIS project, with Access link which just need a little routine in VBA, but I haven't knowledges in VBA language. It's very simple, and it looks like that in a TPascal way : .......
2
by: SunRise | last post by:
Hi I am creating a C Program , to extract only-Printable-characters from a file ( any type of file) and display them. OS: Windows-XP Ple help me to fix the Errors & Warnings and explain...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
1
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't...
3
by: ManningFan | last post by:
Due to the way our IT group has set up our servers, we are not allowed to use the Shell() command. We are already doing a similar action with an FTP command. Our code is thus: sExe =...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.