Re: PQendcopy error in multithreading - Mailing list pgsql-novice

From Sean Davis
Subject Re: PQendcopy error in multithreading
Date
Msg-id 46E6707D.9070704@mail.nih.gov
Whole thread Raw
In response to PQendcopy error in multithreading  (Durgaprasad Pawar <durgaprasad.pawar@yahoo.co.in>)
List 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@mail.nih.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:

Previous
From: Sean Davis
Date:
Subject: Re: PQendcopy error in multithreading
Next
From: johnf
Date:
Subject: Re: the copy command