Re: Incorrect number of rows inserted into partitioned table

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Incorrect number of rows inserted into partitioned table
Дата
Msg-id CAApHDvrY3UJN5xfZ6pACx3zdctXw7jCUaP9GdvfRpUW5vxUENQ@mail.gmail.com
обсуждение исходный текст
Ответ на Incorrect number of rows inserted into partitioned table  (Роман Осипов <osipovromanvladimirovich@gmail.com>)
Список pgsql-bugs
On Tue, 11 Apr 2023 at 08:50, Роман Осипов
<osipovromanvladimirovich@gmail.com> wrote:
> When reloading data from a simple table into a partitioned (through inheritance) using a query like: insert into
[new_partition_table]select * from [old_table] limit xxxxxxx; 
>
> There is an insertion not of the amount specified in limit,, but a little more or less than it.

It would be good to see what your output actually is.  I don't
currently see a way for the number of rows inserted to be *more* than
the LIMIT.  If it's less, then that'll be because of the rule you have
defined to insert into another table instead.

With your example SQLs, you'll probably find that the reported number
of inserted rows matches: select count(*) from ONLY book_inherit_test;

Also, you might want to look at declarative partitioning [1] and use
that instead.

David

[1] https://www.postgresql.org/docs/current/ddl-partitioning.html#DDL-PARTITIONING-DECLARATIVE



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

Предыдущее
От: Роман Осипов
Дата:
Сообщение: Incorrect number of rows inserted into partitioned table
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Incorrect number of rows inserted into partitioned table