Re: Select after insert to the unique column - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Select after insert to the unique column
Date
Msg-id 20041211192913.GA2668@wolff.to
Whole thread Raw
In response to Select after insert to the unique column  (Julian Legeny <legeny@softhome.net>)
Responses Re: Select after insert to the unique column
List pgsql-general
On Wed, Dec 08, 2004 at 14:50:04 +0100,
  Julian Legeny <legeny@softhome.net> wrote:
> Hello,
>
>    Then I want to process command
>       select count(*) from UNIQUE_COLUMN_TEST
>    that I want to know how many records was already inserted before id
>    faied.
>
>    But when I try to process that SELECT COUNT(*), there is error
>    occured again:
>
>    org.postgresql.util.PSQLException:
>    ERROR: current transaction is aborted, commands ignored until end of transaction block
>
>    How can I solve this?

Depending on what you really want to do, you could do each insert in its
own transaction.

If you don't want any of the inserts to succeed if there are problems, then
you should do the counting in the application doing the inserts.

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: question: how to preload data and excute table creation scripts
Next
From: Bruno Wolff III
Date:
Subject: Re: question: how to preload data and excute table creation scripts