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 1k64y8-0006vI-Bu for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Aug 2020 04:36:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k64y7-0007zW-6x for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Aug 2020 04:35:59 +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 1k64y7-0007zP-10 for pgsql-bugs@lists.postgresql.org; Thu, 13 Aug 2020 04:35:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k64y4-0002Bd-8E for pgsql-bugs@lists.postgresql.org; Thu, 13 Aug 2020 04:35:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 07D4ZqrJ398088; Thu, 13 Aug 2020 00:35:52 -0400 From: Tom Lane To: Amit Langote cc: Andres Freund , Pavel Biryukov <79166341370@yandex.ru>, PostgreSQL mailing lists Subject: Re: posgres 12 bug (partitioned table) In-reply-to: References: <141051591267657@mail.yandex.ru> <1251598.1591289850@sss.pgh.pa.us> <20200811180231.fcssvhelqpnydnx7@alap3.anarazel.de> <81885.1597205290@sss.pgh.pa.us> <20200812162718.ycxrktzoe6rpdy5k@alap3.anarazel.de> Comments: In-reply-to Amit Langote message dated "Thu, 13 Aug 2020 13:13:18 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <398086.1597293352.1@sss.pgh.pa.us> Date: Thu, 13 Aug 2020 00:35:52 -0400 Message-ID: <398087.1597293352@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > On Thu, Aug 13, 2020 at 1:27 AM Andres Freund wrote: >> Hm? What are you referencing here? > I meant that WITH specified on a table presumably > forces an AM to ensure that the column is present in its tuples, like > WITH OIDS specification on a table would force heapam to initialize > the oid system column in all tuples being inserted into that table. > Lack of the same notation for other system columns means that AMs > don't feel forced to ensure those columns are present in their tuples. I might be missing some subtlety here, but it seems to me that a given table AM will probably have a fixed set of system columns that it provides. For example heapam would provide exactly the current set of columns, no matter what. I'm imagining that (1) if the parent partitioned table has column X, and the proposed child-table AM doesn't provide that, then we just refuse to create/attach the partition. (2) if a child-table AM provides some system column that the parent does not, then you can access that column when querying the child table directly, but not when querying the parent. This works just like extra child columns in traditional PG inheritance. Given these rules, an AM isn't expected to do anything conditional at runtime: it just provides what it provides. Instead we have an issue to solve in or near the TupleTableSlot APIs, namely how to deal with tuples that don't all have the same system columns. But we'd have that problem anyway. regards, tom lane