You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "wy1433 (via GitHub)" <gi...@apache.org> on 2025/03/18 03:09:42 UTC
[PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
wy1433 opened a new pull request, #35022:
URL: https://github.com/apache/shardingsphere/pull/35022
Fixes #17204.
Changes proposed in this pull request:
- support PostgreSQL/openGauss default schema in config-xxx.xml , Users can specify the search_path of PostgreSQL/openGauss by configuring currentSchema=schemaName
- Limit : only support config a single default schema now
---
Before committing this PR, I'm sure that I have checked the following options:
- [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [ ] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [ ] I have added corresponding unit tests for my changes.
- [ ] I have updated the Release Notes of the current development version. For more details, see [Update Release Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "LoveYou3000 (via GitHub)" <gi...@apache.org>.
LoveYou3000 commented on PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#issuecomment-5043790095
> multidatabase How to configure?
What multi database? Like this: ds1: xxx?current_schema=sc1, ds2: xxx?current_schema=sc2?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "wy1433 (via GitHub)" <gi...@apache.org>.
wy1433 commented on code in PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#discussion_r2000572129
##########
infra/database/type/opengauss/src/main/java/org/apache/shardingsphere/infra/database/opengauss/metadata/data/loader/OpenGaussMetaDataLoader.java:
##########
@@ -70,7 +72,10 @@ public final class OpenGaussMetaDataLoader implements DialectMetaDataLoader {
@Override
public Collection<SchemaMetaData> load(final MetaDataLoaderMaterial material) throws SQLException {
try (Connection connection = material.getDataSource().getConnection()) {
- Collection<String> schemaNames = SchemaMetaDataLoader.loadSchemaNames(connection, TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "openGauss");
+ DialectDatabaseMetaData dialectDatabaseMetaData = new DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData();
+ dialectDatabaseMetaData.getSchema(connection);
Review Comment:
the method getSchema() is overrided in Class OpenGaussDatabaseMetaData, which will set defaultSchema first.
the code like this:
```
@Override
public String getSchema(final Connection connection) {
this.defaultSchema = DialectDatabaseMetaData.super.getSchema(connection);
return this.defaultSchema;
}
```
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "8107mingwang (via GitHub)" <gi...@apache.org>.
8107mingwang commented on PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#issuecomment-3717736058
multidatabase How to configure?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#issuecomment-3592367476
Closed because of no response for long time.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed pull request #35022: support PostgreSQL/openGauss default schema in ds config
URL: https://github.com/apache/shardingsphere/pull/35022
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "wy1433 (via GitHub)" <gi...@apache.org>.
wy1433 commented on code in PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#discussion_r2000560730
##########
infra/database/type/opengauss/src/main/java/org/apache/shardingsphere/infra/database/opengauss/metadata/data/loader/OpenGaussMetaDataLoader.java:
##########
@@ -70,7 +72,10 @@ public final class OpenGaussMetaDataLoader implements DialectMetaDataLoader {
@Override
public Collection<SchemaMetaData> load(final MetaDataLoaderMaterial material) throws SQLException {
try (Connection connection = material.getDataSource().getConnection()) {
- Collection<String> schemaNames = SchemaMetaDataLoader.loadSchemaNames(connection, TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "openGauss");
Review Comment:
The databaseType will be used as a parameter in the two code sections below, so it is computed beforehand for use.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#discussion_r2000538335
##########
infra/database/type/opengauss/src/main/java/org/apache/shardingsphere/infra/database/opengauss/metadata/data/loader/OpenGaussMetaDataLoader.java:
##########
@@ -70,7 +72,10 @@ public final class OpenGaussMetaDataLoader implements DialectMetaDataLoader {
@Override
public Collection<SchemaMetaData> load(final MetaDataLoaderMaterial material) throws SQLException {
try (Connection connection = material.getDataSource().getConnection()) {
- Collection<String> schemaNames = SchemaMetaDataLoader.loadSchemaNames(connection, TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "openGauss");
Review Comment:
What does this code mean?
##########
infra/database/type/opengauss/src/main/java/org/apache/shardingsphere/infra/database/opengauss/metadata/data/loader/OpenGaussMetaDataLoader.java:
##########
@@ -70,7 +72,10 @@ public final class OpenGaussMetaDataLoader implements DialectMetaDataLoader {
@Override
public Collection<SchemaMetaData> load(final MetaDataLoaderMaterial material) throws SQLException {
try (Connection connection = material.getDataSource().getConnection()) {
- Collection<String> schemaNames = SchemaMetaDataLoader.loadSchemaNames(connection, TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "openGauss");
+ DialectDatabaseMetaData dialectDatabaseMetaData = new DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData();
+ dialectDatabaseMetaData.getSchema(connection);
Review Comment:
This method is called, but the return value is not processed. What is the purpose of this?
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] support PostgreSQL/openGauss default schema in ds config [shardingsphere]
Posted by "wy1433 (via GitHub)" <gi...@apache.org>.
wy1433 commented on code in PR #35022:
URL: https://github.com/apache/shardingsphere/pull/35022#discussion_r2000579089
##########
infra/database/type/opengauss/src/main/java/org/apache/shardingsphere/infra/database/opengauss/metadata/data/loader/OpenGaussMetaDataLoader.java:
##########
@@ -70,7 +72,10 @@ public final class OpenGaussMetaDataLoader implements DialectMetaDataLoader {
@Override
public Collection<SchemaMetaData> load(final MetaDataLoaderMaterial material) throws SQLException {
try (Connection connection = material.getDataSource().getConnection()) {
- Collection<String> schemaNames = SchemaMetaDataLoader.loadSchemaNames(connection, TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ DatabaseType databaseType = TypedSPILoader.getService(DatabaseType.class, "openGauss");
+ DialectDatabaseMetaData dialectDatabaseMetaData = new DatabaseTypeRegistry(databaseType).getDialectDatabaseMetaData();
+ dialectDatabaseMetaData.getSchema(connection);
Review Comment:
In the DialectDatabaseMetaData interface, the most appropriate method to override for retrieving the schema based on connection parameters is getSchema
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org