473,811 Members | 2,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting dead locks with 2 functions

I have the following 2 functions and I'm getting deadlocks when I call
them from multiple threads. The first, I'm not sure why because I'm
doing a select for update. The second I'm doing an insert on, and I
thought insert will automatically do a lock as it inserts:

-------------FUNCTION 1: -------------

CREATE OR REPLACE FUNCTION
public.select_p end_visitation_ for_unvisited_l inks(int4)
RETURNS SETOF record AS
'
DECLARE
urlrow RECORD;
BEGIN

FOR urlrow in EXECUTE \'SELECT * FROM "URL" WHERE visited=1::int2
LIMIT \' || $1::int4 || \'FOR UPDATE\'
LOOP
UPDATE "URL" SET visited=2 WHERE "URLID"::in t8 =
urlrow."URLID": :int8;
RETURN NEXT urlrow;
END LOOP;
RETURN;
END;
'
LANGUAGE 'plpgsql' VOLATILE;

-------------FUNCTION 2: -------------

CREATE OR REPLACE FUNCTION public.add_link _to_url_table(v archar, int8,
int4, int2, bool, int2)
RETURNS void AS
'
INSERT INTO "URL"
("rootlessURLSt ring","rootURLI D","rootURLIDPa rtition","visit ed",
"createdAt","up datedAt","isVal id","URLType" )
VALUES ($1, $2, $3, $4, now(), now(), $5, $6 );
'
LANGUAGE 'sql' VOLATILE;

Thanx for the help,
amir

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
0 1058

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

Similar topics

303
17823
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
35
1254
by: Geronimo W. Christ Esq | last post by:
Are there any scripts or tools out there that could look recursively through a group of C/C++ source files, and allow unreferenced function calls or values to be easily identified ? LXR is handy for indexing source code, and for a given function or global variable it can show you all the places where it is referenced. It would be really nice to have a tool that would simply list all of the referenced functions, so that you could go...
6
20632
by: John Carroll | last post by:
Is there a SQL query that can be run against a database that will give me all the details on any locks that are in place at the given time? I am interested in find the lock type and owner. Thank you, John
0
293
by: amir | last post by:
I have the following 2 functions and I'm getting deadlocks when I call them from multiple threads. The first, I'm not sure why because I'm doing a select for update. The second I'm doing an insert on, and I thought insert will automatically do a lock as it inserts: -------------FUNCTION 1: -------------
17
2524
by: euan_woo | last post by:
Hi, Sometimes my program stops and when I break it I see 2 threads both waiting at a lock statement trying to lock the same object. If I look up the call stack of these threads there aren't any other calls to lock statements so I don't see how it's possible for anything to be locked. Can anyone explain this to me? Thanks
2
2273
by: Ben.Combrink | last post by:
Hi I'm using DB2 V9.1.0 on SUSE Linux with kernel version 2.6.5. In the system I'm working on, there are several stored procedures which perform simple selects through different views. Those views are redefined (drop/create) periodically. DB2 rebinds the stored procedures that use the views, automatically.
12
1946
by: better_cs_now | last post by:
Hello all, I suspect that a threading issue is leading to an object being destructed in one thread context while one of its member functions is still running in another thread context. As a means of confirming this, I would like to have the object check if it is alive in the referenced member function and report to me if it is not. However, I cannot think of a standards-compliant way for an object to know that it has been destructed.
8
1680
by: BoneIdol | last post by:
Anyway to do it? I know you can use a variable's contents as a variable name with $$name. With something like this: <?php function foo($bar) { return $bar; } $name = foo($variable_name);
4
10281
by: bukzor | last post by:
Does anyone have a pythonic way to check if a process is dead, given the pid? This is the function I'm using is quite OS dependent. A good candidate might be "try: kill(pid)", since it throws an exception if the pid is dead, but that sends a signal which might interfere with the process. Thanks. --Buck
0
10395
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4352
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3876
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.