TherChenYang opened a new pull request, #31027:
URL: https://github.com/apache/shardingsphere/pull/31027

   Fixes #30993.
   
   Changes proposed in this pull request:
     - Support PostgreSQL COLLATION and CONSTRAINT keywords
   
   The following case parsing is supported
   ```sql
   SELECT
   ci.relname AS index_name,
        con.conname,
        i.indexrelid AS oid,
        ct.relname AS TABLE_NAME,
        i.indrelid AS table_oid,
        am.amname AS index_type,
        i.indisunique AS is_unique,
        i.indisclustered AS is_clustered,
        i.indisprimary AS is_primary,
        pg_get_expr ( indpred, indrelid, TRUE ) AS CONSTRAINT,
        ts.spcname AS tablespace_name,
        pa.rolname AS OWNER,
        ci.reloptions,
        i.indkey,
        i.indclass,
        i.indnatts,
        i.indoption,
        i.indcollation AS COLLATION,
        ci.relpages AS index_pages,
        obj_description ( indexrelid ) AS COMMENT 
   FROM
        pg_index i
        LEFT JOIN pg_class ct ON ct.oid = i.indrelid
        LEFT JOIN pg_class ci ON ci.oid = i.indexrelid
        LEFT JOIN pg_namespace tns ON tns.oid = ct.relnamespace
        LEFT JOIN pg_namespace ins ON ins.oid = ci.relnamespace
        LEFT JOIN pg_tablespace ts ON ci.reltablespace = ts.oid
        LEFT JOIN pg_am am ON ci.relam = am.oid
        LEFT JOIN pg_depend dep ON dep.classid = ci.tableoid 
        AND dep.objid = ci.oid 
        AND dep.refobjsubid = '0'
        LEFT JOIN pg_constraint con ON con.tableoid = dep.refclassid 
        AND con.oid = dep.refobjid
        LEFT JOIN pg_roles pa ON pa.oid = ci.relowner 
   WHERE
        ins.nspname = 'public' 
        AND conname IS NULL 
        AND ct.relname = 't11' 
   ORDER BY
        ct.relname,
        ins.nspname,
        ci.relname
   ```
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following 
options:
   - [x] My code follows the [code of 
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) 
of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have (or in comment I request) added corresponding labels for the 
pull request.
   - [x] 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.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to