Skip to content

Fix external table/FDW metadata queries and update role-grant tests#106

Open
chenjinbao1989 wants to merge 2 commits into
apache:mainfrom
chenjinbao1989:fix_test_1
Open

Fix external table/FDW metadata queries and update role-grant tests#106
chenjinbao1989 wants to merge 2 commits into
apache:mainfrom
chenjinbao1989:fix_test_1

Conversation

@chenjinbao1989

@chenjinbao1989 chenjinbao1989 commented Jul 7, 2026

Copy link
Copy Markdown

backup/queries_externals.go: gp_exttable_fdw represents an unset rejectlimittype as char(-1) ('\377'), not SQL NULL, so GetExternalTableDefinitions was leaking that sentinel through instead of coalescing it to ''.

backup/queries_functions.go: GetForeignDataWrappers and GetForeignServers had no ORDER BY, so Postgres could return rows in a nondeterministic order.

integration/metadata_globals_*_test.go: PG16 reworked role-grant semantics so an implicit grantor always resolves to the bootstrap superuser rather than the acting (super)user, and an explicit GRANTED BY now requires that role to actually hold ADMIN OPTION. Updated fixtures accordingly, and skipped "handles dropped granter" since PG16's grantor dependency tracking means a role can no longer be dropped while still recorded as another membership's grantor.

integration/postdata_create_test.go: updated a hardcoded view-definition golden string to match PG16 ruleutils, which no longer qualifies column references with the table name when only one table is in the FROM clause.

closes: #ISSUE_Number


Change logs

Describe your change clearly, including what problem is being solved or what document is being added or updated.

Contributor's checklist

Here are some reminders before you submit your pull request:

…or PG16

backup/queries_externals.go: gp_exttable_fdw represents an unset
rejectlimittype as char(-1) ('\377'), not SQL NULL, so
GetExternalTableDefinitions was leaking that sentinel through instead of
coalescing it to ''.

backup/queries_functions.go: GetForeignDataWrappers and GetForeignServers
had no ORDER BY, so Postgres could return rows in a nondeterministic order.

integration/metadata_globals_*_test.go: PG16 reworked role-grant semantics
so an implicit grantor always resolves to the bootstrap superuser rather
than the acting (super)user, and an explicit GRANTED BY <role> now requires
that role to actually hold ADMIN OPTION. Updated fixtures accordingly, and
skipped "handles dropped granter" since PG16's grantor dependency tracking
means a role can no longer be dropped while still recorded as another
membership's grantor.

integration/postdata_create_test.go: updated a hardcoded view-definition
golden string to match PG16 ruleutils, which no longer qualifies column
references with the table name when only one table is in the FROM clause.
@chenjinbao1989 chenjinbao1989 changed the title Fix external table/FDW metadata queries and update role-grant tests f… Fix external table/FDW metadata queries and update role-grant tests Jul 7, 2026
@tuhaihe tuhaihe requested review from leborchuk, ostinru and woblerr July 8, 2026 02:05
@tuhaihe

tuhaihe commented Jul 8, 2026

Copy link
Copy Markdown
Member

Hi @chenjinbao1989, can these changes be used for both PG14 and PG16 based Cloudberry versions, or only for PG16 based Cloudberry?

I think we should add the main branch of Cloudberry to the CI pipeline to test these changes as well.

env:
CLOUDBERRY_REPO: apache/cloudberry
# Currently targeting REL_2_STABLE (2.x) branch only.
# TODO: Switch back to "main" once Cloudberry 3.x / main branch stabilizes with PG16 support.
CLOUDBERRY_REF: REL_2_STABLE
CLOUDBERRY_DIR: cloudberry
CLOUDBERRY_BACKUP_DIR: cloudberry-backup

@chenjinbao1989

Copy link
Copy Markdown
Author

Hi @chenjinbao1989, can these changes be used for both PG14 and PG16 based Cloudberry versions, or only for PG16 based Cloudberry?

I think we should add the main branch of Cloudberry to the CI pipeline to test these changes as well.

env:
CLOUDBERRY_REPO: apache/cloudberry
# Currently targeting REL_2_STABLE (2.x) branch only.
# TODO: Switch back to "main" once Cloudberry 3.x / main branch stabilizes with PG16 support.
CLOUDBERRY_REF: REL_2_STABLE
CLOUDBERRY_DIR: cloudberry
CLOUDBERRY_BACKUP_DIR: cloudberry-backup

These changes are only for pg16 based codes.

@tuhaihe tuhaihe added this to the 3.0 milestone Jul 8, 2026
@woblerr

woblerr commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Please update the remaining PG16 ruleutils expectations in the end-to-end test:

  1. key_dependent_view:

    Expect(contents).To(ContainSubstring("CREATE OR REPLACE VIEW public.key_dependent_view AS SELECT view_base_table.key,\n (view_base_table.data COLLATE \"C\") AS data\n FROM public.view_base_table\n GROUP BY view_base_table.key;"))

  2. key_dependent_view_no_cols:

    Expect(contents).To(ContainSubstring("CREATE OR REPLACE VIEW public.key_dependent_view_no_cols AS SELECT\n FROM public.view_base_table\n GROUP BY view_base_table.key\n HAVING (length((view_base_table.data)::text) > 0);"))

CI is currently failing on this mismatch in Cloudberry-backup Tests (end_to_end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants