Search Postgresql Archives

Re: Inserting from multiple processes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 9, 2015 at 8:38 AM, Dave Johansen <davejohansen@xxxxxxxxx> wrote:
On Mon, Jun 8, 2015 at 10:15 AM, Dave Johansen <davejohansen@xxxxxxxxx>
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@xxxxxxxxxxxxxx

Thanks,
Dave

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux