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/12/27 06:56:28 UTC

[GitHub] [shardingsphere] RaigorJiang opened a new issue, #23115: When querying PG metadata through Proxy and the result is empty, labels are lost

RaigorJiang opened a new issue, #23115:
URL: https://github.com/apache/shardingsphere/issues/23115

   ## Bug Report
   ### Which version of ShardingSphere did you use?
   master 7152f643
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   When the PG metadata query result is empty, labels can be kept
   ```sql
    table_schema | table_name | column_name | data_type | type_type | character_maximum_length | column_comment | modifier | is_nullable | column_default | is_autoinc | sequence_name | enum_values | numeric_precision | numeric_scale | size | is_pkey | dimension 
   --------------+------------+-------------+-----------+-----------+--------------------------+----------------+----------+-------------+----------------+------------+---------------+-------------+-------------------+---------------+------+---------+-----------
   (0 rows)
   ```
   
   ### Actual behavior
   ```sql
   sharding_db=> SELECT
        d.nspname AS table_schema,
        c.relname AS table_name,
        a.attname AS column_name,
        COALESCE(td.typname, tb.typname, t.typname) AS data_type,
        COALESCE(td.typtype, tb.typtype, t.typtype) AS type_type,
        a.attlen AS character_maximum_length,
        pg_catalog.col_description(c.oid, a.attnum) AS column_comment,
        a.atttypmod AS modifier,
        a.attnotnull = false AS is_nullable,
        CAST(pg_get_expr(ad.adbin, ad.adrelid) AS varchar) AS column_default,
        coalesce(pg_get_expr(ad.adbin, ad.adrelid) ~ 'nextval',false) OR attidentity != '' AS is_autoinc,
        pg_get_serial_sequence(quote_ident(d.nspname) || '.' || quote_ident(c.relname), a.attname) AS sequence_name,
        CASE WHEN COALESCE(td.typtype, tb.typtype, t.typtype) = 'e'::char
            THEN array_to_string((SELECT array_agg(enumlabel) FROM pg_enum WHERE enumtypid = COALESCE(td.oid, tb.oid, a.atttypid))::varchar[], ',')
            ELSE NULL
        END AS enum_values,
        CASE atttypid
             WHEN 21 /*int2*/ THEN 16
             WHEN 23 /*int4*/ THEN 32
             WHEN 20 /*int8*/ THEN 64
             WHEN 1700 /*numeric*/ THEN
                  CASE WHEN atttypmod = -1
                   THEN null
                   ELSE ((atttypmod - 4) >> 16) & 65535
                   END
             WHEN 700 /*float4*/ THEN 24 /*FLT_MANT_DIG*/
             WHEN 701 /*float8*/ THEN 53 /*DBL_MANT_DIG*/
             ELSE null
          END   AS numeric_precision,
          CASE
        a.attnum;name = 'public'account' AND NOT a.attisdroppedt.contype = 'p'pelem = td.oidt.typelem = tb.oid OR t.typbase
   --
   (0 rows)
   ```
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] totalo closed issue #23115: When querying PG metadata through Proxy and the result is empty, labels are lost

Posted by GitBox <gi...@apache.org>.
totalo closed issue #23115: When querying PG metadata through Proxy and the result is empty, labels are lost
URL: https://github.com/apache/shardingsphere/issues/23115


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