fix(highgo): preserve public functions in schema queries

Closes #5617
This commit is contained in:
t8y2 2026-08-08 17:15:38 +08:00
parent 3d55100717
commit be7b9ac021
No known key found for this signature in database
2 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,14 @@ public final class HighgoAgent extends PostgresLikeAgent {
super(HIGHGO_PROFILE);
}
@Override
public String setSchemaSQL(String schema) {
if ("public".equals(schema)) {
return super.setSchemaSQL(schema);
}
return super.setSchemaSQL(schema) + ", public";
}
public static void main(String[] args) {
new MultiSessionJsonRpcServer(HighgoAgent::new).run();
}

View File

@ -28,6 +28,15 @@ class HighgoAgentTest extends JdbcFakeExecutionBehaviorTest {
Assertions.assertEquals("jdbc:highgo://{host}:{port}/{database}", agent.getProfile().getUrlTemplate());
}
@Test
void preservesPublicFunctionsWhenSwitchingSchemas() {
HighgoAgent agent = new HighgoAgent();
Assertions.assertEquals("SET search_path TO \"app\", public", agent.setSchemaSQL("app"));
Assertions.assertEquals("SET search_path TO \"public\"", agent.setSchemaSQL("public"));
Assertions.assertEquals("SET search_path TO \"PUBLIC\", public", agent.setSchemaSQL("PUBLIC"));
}
@Test
void readsViewSourceWithQuotedRegclassParameter() {
HighgoAgent agent = new HighgoAgent();