apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.65k stars 6.67k forks source link

Consider supporting case sensitivity of table and column names in ShardingSphere metadata #12648

Open strongduanmu opened 2 years ago

strongduanmu commented 2 years ago

Feature Request

By default, ShardingSphere metadata is not case sensitive when processing table names and column names. This may cause some problems on case-sensitive databases.

/**
 * ShardingSphere schema.
 */
@Getter
public final class ShardingSphereSchema {

    private final Map<String, TableMetaData> tables;

    @SuppressWarnings("CollectionWithoutInitialCapacity")
    public ShardingSphereSchema() {
        tables = new ConcurrentHashMap<>();
    }

    public ShardingSphereSchema(final Map<String, TableMetaData> tables) {
        this.tables = new ConcurrentHashMap<>(tables.size(), 1);
        tables.forEach((key, value) -> this.tables.put(key.toLowerCase(), value));
    }
    ...
}

/**
 * Federation schema meta data.
 */
@Getter
public final class FederationSchemaMetaData {

    private final String name;

    private final Map<String, FederationTableMetaData> tables = new LinkedHashMap<>();

    public FederationSchemaMetaData(final String name, final Map<String, TableMetaData> metaData) {
        this.name = name;
        for (Entry<String, TableMetaData> entry : metaData.entrySet()) {
            tables.put(entry.getKey(), new FederationTableMetaData(entry.getValue().getName(), entry.getValue()));
        }
    }

    /**
     * Renew.
     * 
     * @param metaData meta data
     */
    @Synchronized
    public void renew(final TableMetaData metaData) {
        tables.put(metaData.getName().toLowerCase(), new FederationTableMetaData(metaData.getName(), metaData));
    }
    ...
}

Therefore, it is hoped that ShardingSphere can dynamically handle case sensitivity according to the database configuration.

Is your feature request related to a problem?

No related problem.

Describe the feature you would like.

supporting case sensitivity of table and column names in ShardingSphere metadata

github-actions[bot] commented 1 year ago

Hello , this issue has not received a reply for several days. This issue is supposed to be closed.

strongduanmu commented 1 year ago

25349

github-actions[bot] commented 3 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.