You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by "robertmu (via GitHub)" <gi...@apache.org> on 2025/08/27 06:59:44 UTC

[PR] fix(test): adapt GetProceduralLanguages test for Cloudberry filtering behavior [cloudberry-gpbackup]

robertmu opened a new pull request, #29:
URL: https://github.com/apache/cloudberry-gpbackup/pull/29

   The `GetProceduralLanguages` integration test was failing on Cloudberry (PostgreSQL 14) because it expected a manually created procedural language to be returned, but the function was correctly filtering it out.
   
   In PostgreSQL 14, `CREATE LANGUAGE plpython3u` implicitly links the language to the `plpython3u` extension, registering it in `pg_depend` with `deptype = 'e'` (core extension member). The `GetProceduralLanguages` function is designed to filter out these members to prevent duplicate entries during backup, as they are restored via `CREATE EXTENSION`.
   
   This commit adapts the test to reflect this correct behavior on Cloudberry:
   - The test now asserts that `GetProceduralLanguages` returns a list of length 0 on Cloudberry, validating the filtering logic.
   - The cleanup logic is updated to use `DROP EXTENSION` instead of `DROP LANGUAGE` on Cloudberry, as the latter would fail.
   
   This change makes the test more robust by verifying the distinct language handling behaviors between GPDB and Cloudberry.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] fix(test): adjust GetProceduralLanguages test expectations for Cloudberry [cloudberry-gpbackup]

Posted by "gfphoenix78 (via GitHub)" <gi...@apache.org>.
gfphoenix78 merged PR #29:
URL: https://github.com/apache/cloudberry-gpbackup/pull/29


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] fix(test): adjust GetProceduralLanguages test expectations for Cloudberry [cloudberry-gpbackup]

Posted by "gfphoenix78 (via GitHub)" <gi...@apache.org>.
gfphoenix78 commented on code in PR #29:
URL: https://github.com/apache/cloudberry-gpbackup/pull/29#discussion_r2307300092


##########
integration/predata_functions_queries_test.go:
##########
@@ -827,7 +827,16 @@ LANGUAGE SQL`)
 			}
 
 			testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("CREATE LANGUAGE %su", plpythonString))
-			defer testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP LANGUAGE %su", plpythonString))
+
+			// In Cloudberry (PG14+), a direct `CREATE LANGUAGE` command for a language
+			// like plpython3u implicitly links it to its corresponding extension, making
+			// it a core extension member. Therefore, it must be cleaned up by dropping
+			// the extension, not the language.
+			if connectionPool.Version.IsCBDB() {
+				defer testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP EXTENSION IF EXISTS %su CASCADE", plpythonString))

Review Comment:
   I remember that the GPDB also supports `DROP EXTENSION plpython` to drop the language.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org


Re: [PR] fix(test): adjust GetProceduralLanguages test expectations for Cloudberry [cloudberry-gpbackup]

Posted by "robertmu (via GitHub)" <gi...@apache.org>.
robertmu commented on code in PR #29:
URL: https://github.com/apache/cloudberry-gpbackup/pull/29#discussion_r2309446775


##########
integration/predata_functions_queries_test.go:
##########
@@ -827,7 +827,16 @@ LANGUAGE SQL`)
 			}
 
 			testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("CREATE LANGUAGE %su", plpythonString))
-			defer testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP LANGUAGE %su", plpythonString))
+
+			// In Cloudberry (PG14+), a direct `CREATE LANGUAGE` command for a language
+			// like plpython3u implicitly links it to its corresponding extension, making
+			// it a core extension member. Therefore, it must be cleaned up by dropping
+			// the extension, not the language.
+			if connectionPool.Version.IsCBDB() {
+				defer testhelper.AssertQueryRuns(connectionPool, fmt.Sprintf("DROP EXTENSION IF EXISTS %su CASCADE", plpythonString))

Review Comment:
   Thanks for pointing this out! You're absolutely right that both GPDB 7 and 
   Cloudberry support CREATE EXTENSION plpython3u. However, the key difference 
   is in how CREATE LANGUAGE behaves:
   
   - GPDB 7 (PG 12): CREATE LANGUAGE uses pg_pltemplate and creates an independent language object
   - Cloudberry (PG 14): CREATE LANGUAGE internally creates an extension dependency 
     (since pg_pltemplate was deprecated in PG 13)
   
   Since our test specifically uses CREATE LANGUAGE (not CREATE EXTENSION), we need 
   different cleanup strategies. If we were testing CREATE EXTENSION instead, then 
   yes, we could use unified DROP EXTENSION cleanup.
   
   The current approach ensures we're testing the actual CREATE LANGUAGE behavior 
   that users would encounter on each platform.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org