Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plzEK-0003vH-4J for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Apr 2023 21:39:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1plzEH-0001MM-Tg for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Apr 2023 21:39:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plzEH-0001MC-JT for pgsql-bugs@lists.postgresql.org; Mon, 10 Apr 2023 21:39:13 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1plzEF-00045z-CW for pgsql-bugs@lists.postgresql.org; Mon, 10 Apr 2023 21:39:12 +0000 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-94cfe3db2aaso36379666b.0 for ; Mon, 10 Apr 2023 14:39:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1681162749; x=1683754749; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=M+kBwpgXrNAO4ty01kMVRgR9lSbvL9eZCNM5h9E29n0=; b=gk2V5TGTwaUKjR86H+uuojR4OZ3OKOKgjSCmMd0Zhn86sODe0cU+9p5eOCiEDweaFq R7ylEg/jXjuguWsU4H4cTleqfBM3tTTq9S7kGzxWxTPQPHQp+CLlGohX+KYwGleGgIEQ csXY8W0sBORlRGleSoMEzk1uYgnS8OxOpSGDkEm3jiFK+9427S9H8SrXgl7e9ZvM9ZT8 CdadQlRd7IZASFYyupzLRGF7lbdZnOdGtHeuGbnYEN8Xjuyn6aafApWfxorU6+YAK/gi X5T4iCC3v+cpMU2sNJWrDnShaf+GFOsDMv6U20A7pPbo2qaV9uaX/GIC6wclUzF7uICF KIwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681162749; x=1683754749; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M+kBwpgXrNAO4ty01kMVRgR9lSbvL9eZCNM5h9E29n0=; b=q02fxmPHkk8CEYcmAT61C/ADlPowPyj7ODvoeh9iHw2OFqgF7KrKErucmp5QcHRwPy tU318b1xYU1cH/OBJWf1c3JpR1bnOxlNEhdnCk8oQjU+VeM+OdUdVKA8PvJ/h40WNeKj bYtj0Ty3NCYCOlaThtBc31ztJghhv7oiZJ061QJJY7GJoHTGuW5RrXxGYmREUUQbQ10D FYBD0z2C35MSPPlvf2wT+brkG0uURcg/q4Av+mqf/Bezt1QrTkOYvxxPt9MnOVzlqIKu 1m82u5eDyIubL2cgky6rN5eo+gWuETzEMEIutVVPIXLo9FX//bB3xTuEE8JgbVYe9f+x eIRw== X-Gm-Message-State: AAQBX9fdMWmgB4od8ZfLotYMrLXSS1XAAgxmeeCchm8IoZmvDe6m+xKM xnmW4Cj0WBuP8XnmnG3SGWOJmq5fRFLprUvnzAZo5uYCKcLSpj5xFmN2rbwY/r2WQAvtZaAKYat aBGP+FwyBMffvUacW7VcCDk2tY3yv/jqF9mvgrJPU7Y3X4/DJZQdKbh7jIG8lUVACU/AgCbi4Ax 31SD6jOw68c2AnnGoBZRdb8GDMxeIoZ8hLOBcvmeuuAszN6FKAUVq33F0wRA== X-Google-Smtp-Source: AKy350YKAWnBx4pnpXebRDpgS2n42eFH1HgY+dMwhetitTcuM1Kmwu7wcoXj8KTGae+BvGoA88E3Cg== X-Received: by 2002:aa7:cc08:0:b0:504:8410:c7a7 with SMTP id q8-20020aa7cc08000000b005048410c7a7mr9553003edt.20.1681162748664; Mon, 10 Apr 2023 14:39:08 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-228-162.bb.vodafone.cz. [86.49.228.162]) by smtp.gmail.com with ESMTPSA id u24-20020a1709067d1800b0094e1344ddfdsm145269ejo.34.2023.04.10.14.39.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Apr 2023 14:39:08 -0700 (PDT) Message-ID: <4561fe9b-e303-dc28-1a3e-1b5aab626395@enterprisedb.com> Date: Mon, 10 Apr 2023 23:39:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Incorrect number of rows inserted into partitioned table To: =?UTF-8?B?0KDQvtC80LDQvSDQntGB0LjQv9C+0LI=?= , pgsql-bugs@lists.postgresql.org References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/10/23 20:42, Роман Осипов wrote: > Good afternoon > > 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. > Which version? I did try this on master, and I can't reproduce it - the count at the end returns the correct value (1M). The rule affects the insert status, which looks e.g. like this: INSERT 0 611532 instead of 1M, but that's expected because of the rule, I think. FWIW I wonder why you use rules, it's rather tricky to get that right, which is why the usual recommendation is not to use this if there's an alternative way to do stuff (which for partitioning there is). regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company