Skip site navigation (1) Skip section navigation (2)

Re: PQendcopy error in multithreading

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: Durgaprasad Pawar <durgaprasad(dot)pawar(at)yahoo(dot)co(dot)in>, pg novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: PQendcopy error in multithreading
Date: 2007-09-11 10:39:57
Message-ID: 46E6707D.9070704@mail.nih.gov (view raw or flat)
Thread:
Lists: pgsql-novice
Durgaprasad Pawar wrote:
> Hey ! Thanks a lot !! It gave me an error message as follows:
> 
> Error : ERROR:  new row for relation "****_06032007" violates check
> constraint "****_06032007_date_range_check
> 
> Seems like one of my threads is trying to insert a record of some date
> into a table of other date.
> 
> How do I make these messages appear on the NOVICE list? Your reply
> appears on the list. However, mine doesn't.

Not sure what the problem might be for you.  But I am glad you got the
error message you needed.

Sean


> 
> */Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>/* wrote:
> 
>     Durgaprasad Pawar wrote:
>     > No. I am using different connections in different threads. Each thread
>     > is given a separate connection from a pool of connections at the
>     > beginning of its execution.
> 
>     Great. So the next thing to figure out is what error is being
>     generated. From the Postgres docs for PQendcopy:
> 
>     "...The return value is 0 on successful completion, nonzero otherwise.
>     (Use PQerrorMessage to retrieve details if the return value is
>     nonzero.)"
> 
>     Hope that does it for you.
> 
>     Sean
> 
> 
> 
>     > */Sean Davis /* wrote:
>     >
>     > Durgaprasad Pawar wrote:
>     > > Hi,
>     > > I am trying to update multiple tables using the
>     > > 'PQputline/PQendcopy' function. The code works fine if the
>     tables are
>     > > updated one after the other.
>     > > However, if there are multiple threads trying to copy data into
>     > > different tables, the function fails. i.e. if one thread has
>     > started its
>     > > copy operation and if some other thread also starts its copy
>     operation
>     > > (on different table), one of them fails.
>     > > Strangely, the PQputline function is successful for both the threads
>     > > after the end delimiter is sent (\.).
>     > > What might be the reason for this PQendcopy failure? How do I
>     get the
>     > > exact error message after the failure?
>     >
>     > Are you trying to do this using the same connection in different
>     > threads, or does each thread have its own connection? I suspect
>     you are
>     > trying to do the former.
>     >
>     > Sean
>     >
>     > ---------------------------(end of
>     broadcast)---------------------------
>     > TIP 3: Have you checked our extensive FAQ?
>     >
>     > http://www.postgresql.org/docs/faq
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     > Get the freedom to save as many mails as you wish. Click here to know
>     > how.
>     >
>     >
> 
> 
> ------------------------------------------------------------------------
> 5, 50, 500, 5000 - Store N number of mails in your inbox. Click here.
> <http://in.rd.yahoo.com/tagline_mail_4/*http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/>
> 

pgsql-novice by date

Next:From: johnfDate: 2007-09-11 13:50:07
Subject: Re: the copy command
Previous:From: Sean DavisDate: 2007-09-11 08:24:15
Subject: Re: PQendcopy error in multithreading

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group