You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/04/02 10:20:58 UTC

[GitHub] [shardingsphere] azexcy commented on pull request #16568: Support PostgreSQL auto create table

azexcy commented on pull request #16568:
URL: https://github.com/apache/shardingsphere/pull/16568#issuecomment-1086609414


   jdbc test in local 
   
   ```java
   public class CreateTableIndexTest {
       
       public static void main(String[] args) throws Exception {
           ShardingSpherePipelineDataSourceConfiguration pipelineDataSourceConfig = new ShardingSpherePipelineDataSourceConfiguration(
                   ConfigurationFileUtil.readFile("test0402.yaml"));
           try (ShardingSphereDataSource dataSource =
                        (ShardingSphereDataSource) new PipelineDataSourceFactory().newInstance(pipelineDataSourceConfig).getDataSource();) {
               // execute sql
               try (Connection connection = dataSource.getConnection()) {
                   connection.createStatement().execute("CREATE TABLE IF NOT EXISTS t_order(order_id bigint NOT NULL," +
                           "user_id integer NOT NULL,status character varying(50));");
                   connection.createStatement().execute("CREATE UNIQUE INDEX t_order_pkey ON t_order USING btree " +
                           "(order_id);");
                   connection.createStatement().execute("CREATE INDEX t_order_status_idx_t_order ON t_order USING btree " +
                           "(status);");
               }
           }
       }
   }
   ```


-- 
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