Allow user to use LIKE to create foreign tables, ex:
CREATE FOREIGN TABLE ft(LIKE t1);
Foreign table ft will use t1's column definitions as its own.
In CBDB, we usually use foreign tables to import data from outside data source.
Each target table usually has an associated foreign table.
This is very useful if target table has a lot of columns, making it easy to create a foreign table without defining columns one by one, and avoid mistake.
Distribution policy is not inherited for this case because it should be defined with options by users.
CREATE FOREIGN DATA WRAPPER dummy;
CREATE SERVER s0 FOREIGN DATA WRAPPER dummy;
CREATE TABLE ft_source_table(a INT, b INT, c INT) DISTRIBUTED BY (b);
CREATE FOREIGN TABLE ft_like (LIKE ft_source_table) SERVER s0;
\d+ ft_like
Foreign table "public.ft_like"
Column | Type | Collation | Nullable | Default | FDW options | Storage | Stats target | Description
--------+---------+-----------+----------+---------+-------------+---------+--------------+-------------
a | integer | | | | | plain | |
b | integer | | | | | plain | |
c | integer | | | | | plain | |
Server: s0
Authored-by: Zhang Mingli avamingli@gmail.com
fix #ISSUE_Number
Change logs
Describe your change clearly, including what problem is being solved or what feature is being added.
If it has some breaking backward or forward compatibility, please clary.
Why are the changes needed?
Describe why the changes are necessary.
Does this PR introduce any user-facing change?
If yes, please clarify the previous behavior and the change this PR proposes.
How was this patch tested?
Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.
Contributor's Checklist
Here are some reminders and checklists before/when submitting your pull request, please check them:
[ ] Make sure your Pull Request has a clear title and commit message. You can take git-commit template as a reference.
[ ] Sign the Contributor License Agreement as prompted for your first-time contribution(One-time setup).
Allow user to use LIKE to create foreign tables, ex:
Foreign table ft will use t1's column definitions as its own.
In CBDB, we usually use foreign tables to import data from outside data source. Each target table usually has an associated foreign table. This is very useful if target table has a lot of columns, making it easy to create a foreign table without defining columns one by one, and avoid mistake.
Distribution policy is not inherited for this case because it should be defined with options by users.
Authored-by: Zhang Mingli avamingli@gmail.com
fix #ISSUE_Number
Change logs
Describe your change clearly, including what problem is being solved or what feature is being added.
If it has some breaking backward or forward compatibility, please clary.
Why are the changes needed?
Describe why the changes are necessary.
Does this PR introduce any user-facing change?
If yes, please clarify the previous behavior and the change this PR proposes.
How was this patch tested?
Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.
Contributor's Checklist
Here are some reminders and checklists before/when submitting your pull request, please check them:
make installcheck
make -C src/test installcheck-cbdb-parallel
cloudberrydb/dev
team for review and approval when your PR is ready🥳