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?  (Francisco Olarte <folarte@peoplecall.com>)
Список 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

Thanks,
Dave

В списке pgsql-general по дате отправления:

Предыдущее
От: Gavin Flower
Дата:
Сообщение: Re: Re: INSERT a real number in a column based on other columns OLD INSERTs
Следующее
От: 娄帅
Дата:
Сообщение: Question about the isolation level and visible