Re: Inserting from multiple processes?

From: Dave Johansen <davejohansen(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Inserting from multiple processes?
Date: 2015-06-26 00:59:06
Message-ID: CAAcYxUfsktvRfyHY59pCu_SUNB+ayF9FdZUjhcqUEgeKcY-MGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 9, 2015 at 8:38 AM, Dave Johansen <davejohansen(at)gmail(dot)com>
wrote:

> On Mon, Jun 8, 2015 at 10:15 AM, Dave Johansen <davejohansen(at)gmail(dot)com>
> For the sake of documentation, here's the function that I used to
> accomplish this:
> CREATE FUNCTION insert_test_no_dup(tutc_ TIMESTAMP WITHOUT TIME ZONE, id_
> INTEGER, value_ INTEGER) RETURNS VOID AS
> $$
> BEGIN
> BEGIN
> INSERT INTO test(tutc, id, value) VALUES (tutc_, id_, value_);
> RETURN;
> EXCEPTION WHEN unique_violation THEN
> -- do nothing because the record already exists
> END;
> END;
> $$
> LANGUAGE plpgsql;
>

It appears that calling "SELECT insert_test_no_dup('2015-01-01', 1, 1)"
cause the XID to increment? I'm not sure if it's only when the exception
happens or all the time, but if there some way to prevent the increment of
XID because it's causing problems with our system:
http://www.postgresql.org/message-id/CAAcYxUer3MA=enXvnOwe0oSAA8ComvxCF6OrHp-vUppr56twFg@mail.gmail.com

Thanks,
Dave

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message 娄帅 2015-06-26 01:11:43 Question about the isolation level and visible
Previous Message Gavin Flower 2015-06-25 23:25:04 Re: Re: INSERT a real number in a column based on other columns OLD INSERTs