Re: Inserting from multiple processes?
От | Dave Johansen |
---|---|
Тема | Re: Inserting from multiple processes? |
Дата | |
Msg-id | CAAcYxUfsktvRfyHY59pCu_SUNB+ayF9FdZUjhcqUEgeKcY-MGw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Inserting from multiple processes? (Dave Johansen <davejohansen@gmail.com>) |
Ответы |
Re: Inserting from multiple processes?
|
Список | pgsql-general |
On Tue, Jun 9, 2015 at 8:38 AM, Dave Johansen <davejohansen@gmail.com> wrote:
On Mon, Jun 8, 2015 at 10:15 AM, Dave Johansen <davejohansen@gmail.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
http://www.postgresql.org/message-id/CAAcYxUer3MA=enXvnOwe0oSAA8ComvxCF6OrHp-vUppr56twFg@mail.gmail.com
Thanks,
Dave
В списке pgsql-general по дате отправления: