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 1teZxn-00EOU1-8W for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 13:24:39 +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 1teZxl-007GX1-9a for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Feb 2025 13:24:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1teZxl-007GWt-0G for pgsql-hackers@lists.postgresql.org; Sun, 02 Feb 2025 13:24:37 +0000 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1teZxh-002rU1-2r for pgsql-hackers@lists.postgresql.org; Sun, 02 Feb 2025 13:24:36 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id BF4F81380E53; Sun, 2 Feb 2025 08:24:32 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Sun, 02 Feb 2025 08:24:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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 :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1738502672; x=1738589072; bh=7 eJgPm7emDsBL/MS1Pr+iOYuRh2eSG75dC0f38PwbcA=; b=XJo67VgXctddd8kZN a8ulfXa4S8vSkpXy+G+coCT0Rc90z643kMJvo4Bjhm2gKIiRX4VouoS30W/iQzDu IMhY+AgYDKLbzP8NvSIXwQQyrbiweinGnSRIYAjdjQM2u91ekpg8nEAXapUrv60+ qIr8+x1LM7Ajl16KwBAdaE766aa9Qci0TZhZScXE6u90CgVUU1cx+ECNgKuaI2si UU9OrWXsqEKni3nHkLgwPY//sjNZ/vVwn/2klq4zxPsNJP6KVrXqOj9OrrIJOH6T Eul14TEASubqUBTzDNBKliU1YCmb6o9tJUCWBDFn1Q5dTbp21+TY8wPO5i9P4Ftm vx9MA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeejlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpemllhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvheeuffehgfeukeeufeeh hefghfeugfefudekjeevudffgeffkeegffffveegheenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepiihmlhhpohhs thhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrh hssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 2 Feb 2025 08:24:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1738502669; bh=0iwTOa2e5mu1ce4AhApyMUUmA/wN5vsnIM29DB7iE8A=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Q15cF6v1N2O/U8nqZ/UnJcAOYbYA9pemSNdgicFDe9//pBE3WJJfARwz6Oemssbdw Efk/nmxvZt7xoGiZ5qttrQnh4oQQbkVFyYggXDiJqjYq/qWM3bO+jWftR2WHv8VcVH ElpLbOUbDoew+qnMr+sFRl+d3uNnbwG2gtCsMTNgZnKC+dfn+jaSekfyx22H9uPYJL mBK0MSIK18Nen0huDWcUkdlg8+XdQox25VzmtDiqNS4CdFSDCCVe7BKf6TRsf5fxSn w6uF6FdZUN2AgswJ0u04EYxxl5Yt8dSaVMQslO4bZ9rwDE7rJ33eVxnMper85irUVg gxBISN/MFa5JA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id D4CB08F; Sun, 2 Feb 2025 14:24:29 +0100 (CET) Date: Sun, 2 Feb 2025 14:24:29 +0100 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Zhang Mingli Cc: PostgreSQL Hackers Subject: Re: Proposal to CREATE FOREIGN TABLE LIKE Message-ID: <202502021324.vn4ufyduifat@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Feb-01, Zhang Mingli wrote: > For example, we use kafka_fdw to produce and consume data from a Kafka > server. In our scenario, we sometimes need to write records from a > local table into Kafka. Here’s a brief outline of our process: > > 1. We already have a wide table, local_wide_table in Postgres. > 2. We need to create a foreign table, foreign_table, with the same > definition as local_wide_table. > 3. Insert records into foreign_table by selecting > from local_wide_table with the some quals. > > In step 2, we currently have to manually create the foreign table > using CREATE FOREIGN TABLE and copy the column definitions one by one. Eh yeah, I guess for this use case it makes sense to allow a LIKE clause on CREATE FOREIGN TABLE. Were you going to submit a patch? -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Having your biases confirmed independently is how scientific progress is made, and hence made our great society what it is today" (Mary Gardiner)