Re: Proposal to CREATE FOREIGN TABLE LIKE

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal to CREATE FOREIGN TABLE LIKE
Date: 2025-02-02 13:24:29
Message-ID: 202502021324.vn4ufyduifat@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-02-02 13:45:35 Re: pgbench with partitioned tables
Previous Message Alvaro Herrera 2025-02-02 13:21:33 Re: why there is not VACUUM FULL CONCURRENTLY?