Re: Proposal to CREATE FOREIGN TABLE LIKE

Zhang Mingli <zmlpostgres@gmail.com>

From: Zhang Mingli <zmlpostgres@gmail.com>
To: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Michael Paquier <michael@paquier.xyz>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-06T12:13:47Z
Lists: pgsql-hackers
On Feb 6, 2025 at 18:31 +0800, Álvaro Herrera <alvherre@alvh.no-ip.org>, wrote:
>
> Ah, but our fine manual already says
>
> The LIKE clause can also be used to copy column definitions from views,
> foreign tables, or composite types. Inapplicable options (e.g.,
> INCLUDING INDEXES from a view) are ignored.
>
> so what you implemented seems to be okay from that POV.
Hi, Yeah,

Our current convention is to ignore any inapplicable options without throwing errors.

As you mentioned, we use bits to identify the options, which does add some complexity to the codes if we try to track the origin of the option bits.

--
Zhang Mingli
HashData

Commits

  1. Add support for LIKE in CREATE FOREIGN TABLE