Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qTJ92-00986q-BJ for pgsql-docs@arkaria.postgresql.org; Tue, 08 Aug 2023 09:36:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qTJ90-00Fdt5-N0 for pgsql-docs@arkaria.postgresql.org; Tue, 08 Aug 2023 09:36:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qTJ8y-00Fdsx-VT for pgsql-docs@lists.postgresql.org; Tue, 08 Aug 2023 09:36:50 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qTJ8u-001Bf4-ML for pgsql-docs@lists.postgresql.org; Tue, 08 Aug 2023 09:36:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 292FD5C0108; Tue, 8 Aug 2023 05:36:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 08 Aug 2023 05:36:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1691487403; x=1691573803; bh=Vy4sWpl7IzaHRPbkg64G1J+eGbSFlNEbpQ1 C4gqvW3w=; b=qrDW9fzV66yXoJugaxV9C3LfWZ7JccP7QdhSGodtvBwSfhLmV1c rhhNuA/r3/KzYtC/cm4feOloCn8xJ+TFI2xFdu9yjMLLxKfMIxMgc3Y5UkXLlKU9 NXK67ta5TDZQbK6RdqagG0qPVXYWMkewKk7GpuQvgeHvZy9P4XCUyFcXbaRUX2dH ij5eURZom84Qw2/wn5uwbD7707k5gGyDaNbaDMgxvi4IT7pTQYtCMWtTJjD4x0pM 73KaknToHA70YXnj1VI3WkExBeMF7XXeN2zTVIiwe4287K0a4uJmo1+FXodaEWaJ EslggnmMV94a5HhHkf1NLuZqrwInCDTNcKg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1691487403; x= 1691573803; bh=Vy4sWpl7IzaHRPbkg64G1J+eGbSFlNEbpQ1C4gqvW3w=; b=l dwovl+CQ4mrN9R+jqtuHmG/BzDp96M7R+TIBYRdAQ7VrNv4A/EOV364Z3q68WXD6 vQFXtLGIXguUDSYpYhaR/axgkpowf47F0sXZWqc6A5nLgElD4l2nymOuS7Ak9/ng KwXyJdWimIS1/MD4XzAdp5k4infjaX2uaD7kB3R/2whvJL6V05MkjBONH08JqotW zJlU4r4YMXrKza7bZU7C20LyBa1aF6sI9zNVGOKxGTPxFsRv5zHZFHxDDvsOT48B QJ/jshljOTY7Tgpz+RUS1ItiQi7QGIFvjG2/zubBXxGSdOi7ZrkCQG4DcngPDBAs 40xbcIZreKkLadTMcvQRQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrledvgddujecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthejre dttdefjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhes vghishgvnhhtrhgruhhtrdhorhhgqeenucggtffrrghtthgvrhhnpedugfduudehhfejie euudfhieffveeghffggffhgfffgfduvefhleejieejhfduleenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrsegvihhsvghnthhrrg huthdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Aug 2023 05:36:42 -0400 (EDT) Message-ID: Date: Tue, 8 Aug 2023 11:36:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: 3.6 Inheritance Documentation Content-Language: en-US To: watermelonmania79@gmail.com, pgsql-docs@lists.postgresql.org References: <169100604868.635.1178692927881377748@wrigleys.postgresql.org> From: Peter Eisentraut In-Reply-To: <169100604868.635.1178692927881377748@wrigleys.postgresql.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 02.08.23 21:54, PG Doc comments form wrote: > In the provided example, the cities table and the capitals table have a > parent-child relationship through inheritance. However, querying the cities > table directly (e.g., SELECT name, elevation FROM cities WHERE elevation > > 500;) will not automatically include data from the child table, capitals. > Inheritance in PostgreSQL does not implicitly combine data from parent and > child tables in a single query. This observation is patently incorrect: CREATE TABLE cities ( name text, population real, elevation int -- (in ft) ); CREATE TABLE capitals ( state char(2) UNIQUE NOT NULL ) INHERITS (cities); INSERT INTO cities (name) VALUES ('Ithaca'); INSERT INTO capitals (name, state) VALUES ('Albany', 'NY'); SELECT * FROM cities; name | population | elevation --------+------------+----------- Ithaca | | Albany | | (2 rows) SELECT * FROM capitals; name | population | elevation | state --------+------------+-----------+------- Albany | | | NY (1 row)