kimmking edited a comment on issue #4471: Can ado.net connect sharding-proxy?
URL: 
https://github.com/apache/incubator-shardingsphere/issues/4471#issuecomment-592299116
 
 
   I reproduce this issue in Windows 10 now.
   Psql in command line work well.
   But ADO.NET can't open connection.
   
   1.Exception in dotnet: 
   ```
   {"Received unexpected backend message CompletedResponse. Please file a bug."}
   ```
   2.Log in proxy console:
   ```
   [INFO ] 11:54:00.202 [nioEventLoopGroup-2-1] 
i.n.handler.logging.LoggingHandler - [id: 0x2cd6b7dd, L:/0:0:0:0:0:0:0:0:3309] 
READ: [id: 0xfc877f9c, L:/0:0:0:0:0:0:0:1:3309 - R:/0:0:0:0:0:0:0:1:60669]
   [INFO ] 11:54:00.202 [nioEventLoopGroup-2-1] 
i.n.handler.logging.LoggingHandler - [id: 0x2cd6b7dd, L:/0:0:0:0:0:0:0:0:3309] 
READ COMPLETE
   [INFO ] 11:54:00.407 [pool-12-thread-1] ShardingSphere-SQL - Rule Type: 
sharding
   [INFO ] 11:54:00.407 [pool-12-thread-1] ShardingSphere-SQL - Logic SQL:
   SELECT ns.nspname, typ_and_elem_type.*,
      CASE
          WHEN typtype IN ('b', 'e', 'p') THEN 0           -- First base types, 
enums, pseudo-types
          WHEN typtype = 'r' THEN 1                        -- Ranges after
          WHEN typtype = 'c' THEN 2                        -- Composites after
          WHEN typtype = 'd' AND elemtyptype <> 'a' THEN 3 -- Domains over 
non-arrays after
          WHEN typtype = 'a' THEN 4                        -- Arrays before
          WHEN typtype = 'd' AND elemtyptype = 'a' THEN 5  -- Domains over 
arrays last
       END AS ord
   FROM (
       -- Arrays have typtype=b - this subquery identifies them by their 
typreceive and converts their typtype to a
       -- We first do this for the type (innerest-most subquery), and then for 
its element type
       -- This also returns the array element, range subtype and domain base 
type as elemtypoid
       SELECT
           typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, 
typ.typnotnull, typ.relkind,
           elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, 
elemcls.relkind AS elemrelkind,
           CASE WHEN elemproc.proname='array_recv' THEN 'a' ELSE 
elemtyp.typtype END AS elemtyptype
       FROM (
           SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, 
relkind, typelem AS elemoid,
               CASE WHEN proc.proname='array_recv' THEN 'a' ELSE typ.typtype 
END AS typtype,
               CASE
                   WHEN proc.proname='array_recv' THEN typ.typelem
   
                   WHEN typ.typtype='d' THEN typ.typbasetype
               END AS elemtypoid
           FROM pg_type AS typ
           LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
           LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
   
       ) AS typ
       LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
       LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
       LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
   ) AS typ_and_elem_type
   JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
   WHERE
       typtype IN ('b', 'r', 'e', 'd') OR -- Base, range, enum, domain
       (typtype = 'c' AND relkind='c') OR -- User-defined free-standing 
composites (not table composites) by default
       (typtype = 'p' AND typname IN ('record', 'void')) OR -- Some special 
supported pseudo-types
       (typtype = 'a' AND (  -- Array of...
           elemtyptype IN ('b', 'r', 'e', 'd') OR -- Array of base, range, 
enum, domain
           (elemtyptype = 'p' AND elemtypname IN ('record', 'void')) OR -- 
Arrays of special supported pseudo-types
           (elemtyptype = 'c' AND elemrelkind='c') -- Array of user-defined 
free-standing composites (not table composites) by default
       ))
   ORDER BY ord
   [INFO ] 11:54:00.408 [pool-12-thread-1] ShardingSphere-SQL - SQLStatement: 
SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@4728add5,
 tablesContext=TablesContext(tables=[], schema=Optional.absent())), 
projectionsContext=ProjectionsContext(startIndex=8, stopIndex=117, 
distinctRow=false, projections=[ColumnProjection(owner=ns, name=nspname, 
alias=Optional.absent()), 
ShorthandProjection(owner=Optional.of(typ_and_elem_type)), 
ExpressionProjection(expression=CASEWHENtyptypeIN('b','e','p')THEN0--Firstbase, 
alias=Optional.of(base))], columnLabels=[nspname, base]), 
groupByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.groupby.GroupByContext@2017b6be,
 
orderByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.orderby.OrderByContext@24283664,
 
paginationContext=org.apache.shardingsphere.sql.parser.relation.segment.select.pagination.PaginationContext@612abc85,
 containsSubquery=false)
   [INFO ] 11:54:00.409 [pool-12-thread-1] ShardingSphere-SQL - Actual SQL: 
test :::
   SELECT ns.nspname, typ_and_elem_type.*,
      CASE
          WHEN typtype IN ('b', 'e', 'p') THEN 0           -- First base types, 
enums, pseudo-types
          WHEN typtype = 'r' THEN 1                        -- Ranges after
          WHEN typtype = 'c' THEN 2                        -- Composites after
          WHEN typtype = 'd' AND elemtyptype <> 'a' THEN 3 -- Domains over 
non-arrays after
          WHEN typtype = 'a' THEN 4                        -- Arrays before
          WHEN typtype = 'd' AND elemtyptype = 'a' THEN 5  -- Domains over 
arrays last
       END AS ord
   FROM (
       -- Arrays have typtype=b - this subquery identifies them by their 
typreceive and converts their typtype to a
       -- We first do this for the type (innerest-most subquery), and then for 
its element type
       -- This also returns the array element, range subtype and domain base 
type as elemtypoid
       SELECT
           typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, 
typ.typnotnull, typ.relkind,
           elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, 
elemcls.relkind AS elemrelkind,
           CASE WHEN elemproc.proname='array_recv' THEN 'a' ELSE 
elemtyp.typtype END AS elemtyptype
       FROM (
           SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, 
relkind, typelem AS elemoid,
               CASE WHEN proc.proname='array_recv' THEN 'a' ELSE typ.typtype 
END AS typtype,
               CASE
                   WHEN proc.proname='array_recv' THEN typ.typelem
   
                   WHEN typ.typtype='d' THEN typ.typbasetype
               END AS elemtypoid
           FROM pg_type AS typ
           LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
           LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
   
       ) AS typ
       LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
       LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
       LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
   ) AS typ_and_elem_type
   JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
   WHERE
       typtype IN ('b', 'r', 'e', 'd') OR -- Base, range, enum, domain
       (typtype = 'c' AND relkind='c') OR -- User-defined free-standing 
composites (not table composites) by default
       (typtype = 'p' AND typname IN ('record', 'void')) OR -- Some special 
supported pseudo-types
       (typtype = 'a' AND (  -- Array of...
           elemtyptype IN ('b', 'r', 'e', 'd') OR -- Array of base, range, 
enum, domain
           (elemtyptype = 'p' AND elemtypname IN ('record', 'void')) OR -- 
Arrays of special supported pseudo-types
           (elemtyptype = 'c' AND elemrelkind='c') -- Array of user-defined 
free-standing composites (not table composites) by default
       ))
   ORDER BY ord
   line 1:0 no viable alternative at input '-'
   line 1:0 mismatched input '-' expecting {SELECT, INSERT, UPDATE, DELETE, 
CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE, SET, BEGIN, COMMIT, ROLLBACK, 
SAVEPOINT, CALL, START, RESET, SHOW}
   [ERROR] 11:54:00.429 [pool-12-thread-1] o.a.s.s.f.c.CommandExecutorTask - 
Exception occur:
   org.apache.shardingsphere.sql.parser.exception.SQLParsingException: 
Unsupported SQL of `-- Load field definitions for (free-standing) composite 
types
   SELECT typ.oid, att.attname, att.atttypid
   FROM pg_type AS typ
   JOIN pg_namespace AS ns ON (ns.oid = typ.typnamespace)
   JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
   JOIN pg_attribute AS att ON (att.attrelid = typ.typrelid)
   WHERE
     (typ.typtype = 'c' AND cls.relkind='c') AND
     attnum > 0 AND     -- Don't load system attributes
     NOT attisdropped
   ORDER BY typ.oid, att.attnum`
           at 
org.apache.shardingsphere.sql.parser.core.parser.SQLParserEngine.parse(SQLParserEngine.java:71)
           at 
org.apache.shardingsphere.sql.parser.core.SQLParseKernel.parse(SQLParseKernel.java:58)
           at 
org.apache.shardingsphere.sql.parser.SQLParseEngine.parse0(SQLParseEngine.java:68)
           at 
org.apache.shardingsphere.sql.parser.SQLParseEngine.parse(SQLParseEngine.java:50)
           at 
org.apache.shardingsphere.shardingproxy.frontend.postgresql.command.query.binary.parse.PostgreSQLComParseExecutor.execute(PostgreSQLComParseExecutor.java:53)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:90)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:70)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
   [INFO ] 11:54:00.430 [pool-12-thread-1] ShardingSphere-SQL - Rule Type: 
sharding
   [INFO ] 11:54:00.430 [pool-12-thread-1] ShardingSphere-SQL - Logic SQL:
   SELECT ns.nspname, typ_and_elem_type.*,
      CASE
          WHEN typtype IN ('b', 'e', 'p') THEN 0           -- First base types, 
enums, pseudo-types
          WHEN typtype = 'r' THEN 1                        -- Ranges after
          WHEN typtype = 'c' THEN 2                        -- Composites after
          WHEN typtype = 'd' AND elemtyptype <> 'a' THEN 3 -- Domains over 
non-arrays after
          WHEN typtype = 'a' THEN 4                        -- Arrays before
          WHEN typtype = 'd' AND elemtyptype = 'a' THEN 5  -- Domains over 
arrays last
       END AS ord
   FROM (
       -- Arrays have typtype=b - this subquery identifies them by their 
typreceive and converts their typtype to a
       -- We first do this for the type (innerest-most subquery), and then for 
its element type
       -- This also returns the array element, range subtype and domain base 
type as elemtypoid
       SELECT
           typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, 
typ.typnotnull, typ.relkind,
           elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, 
elemcls.relkind AS elemrelkind,
           CASE WHEN elemproc.proname='array_recv' THEN 'a' ELSE 
elemtyp.typtype END AS elemtyptype
       FROM (
           SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, 
relkind, typelem AS elemoid,
               CASE WHEN proc.proname='array_recv' THEN 'a' ELSE typ.typtype 
END AS typtype,
               CASE
                   WHEN proc.proname='array_recv' THEN typ.typelem
   
                   WHEN typ.typtype='d' THEN typ.typbasetype
               END AS elemtypoid
           FROM pg_type AS typ
           LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
           LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
   
       ) AS typ
       LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
       LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
       LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
   ) AS typ_and_elem_type
   JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
   WHERE
       typtype IN ('b', 'r', 'e', 'd') OR -- Base, range, enum, domain
       (typtype = 'c' AND relkind='c') OR -- User-defined free-standing 
composites (not table composites) by default
       (typtype = 'p' AND typname IN ('record', 'void')) OR -- Some special 
supported pseudo-types
       (typtype = 'a' AND (  -- Array of...
           elemtyptype IN ('b', 'r', 'e', 'd') OR -- Array of base, range, 
enum, domain
           (elemtyptype = 'p' AND elemtypname IN ('record', 'void')) OR -- 
Arrays of special supported pseudo-types
           (elemtyptype = 'c' AND elemrelkind='c') -- Array of user-defined 
free-standing composites (not table composites) by default
       ))
   ORDER BY ord
   [INFO ] 11:54:00.431 [pool-12-thread-1] ShardingSphere-SQL - SQLStatement: 
SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@4728add5,
 tablesContext=TablesContext(tables=[], schema=Optional.absent())), 
projectionsContext=ProjectionsContext(startIndex=8, stopIndex=117, 
distinctRow=false, projections=[ColumnProjection(owner=ns, name=nspname, 
alias=Optional.absent()), 
ShorthandProjection(owner=Optional.of(typ_and_elem_type)), 
ExpressionProjection(expression=CASEWHENtyptypeIN('b','e','p')THEN0--Firstbase, 
alias=Optional.of(base))], columnLabels=[nspname, base]), 
groupByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.groupby.GroupByContext@63321445,
 
orderByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.orderby.OrderByContext@2efba368,
 
paginationContext=org.apache.shardingsphere.sql.parser.relation.segment.select.pagination.PaginationContext@54bbe6e,
 containsSubquery=false)
   [INFO ] 11:54:00.432 [pool-12-thread-1] ShardingSphere-SQL - Actual SQL: 
test :::
   SELECT ns.nspname, typ_and_elem_type.*,
      CASE
          WHEN typtype IN ('b', 'e', 'p') THEN 0           -- First base types, 
enums, pseudo-types
          WHEN typtype = 'r' THEN 1                        -- Ranges after
          WHEN typtype = 'c' THEN 2                        -- Composites after
          WHEN typtype = 'd' AND elemtyptype <> 'a' THEN 3 -- Domains over 
non-arrays after
          WHEN typtype = 'a' THEN 4                        -- Arrays before
          WHEN typtype = 'd' AND elemtyptype = 'a' THEN 5  -- Domains over 
arrays last
       END AS ord
   FROM (
       -- Arrays have typtype=b - this subquery identifies them by their 
typreceive and converts their typtype to a
       -- We first do this for the type (innerest-most subquery), and then for 
its element type
       -- This also returns the array element, range subtype and domain base 
type as elemtypoid
       SELECT
           typ.oid, typ.typnamespace, typ.typname, typ.typtype, typ.typrelid, 
typ.typnotnull, typ.relkind,
           elemtyp.oid AS elemtypoid, elemtyp.typname AS elemtypname, 
elemcls.relkind AS elemrelkind,
           CASE WHEN elemproc.proname='array_recv' THEN 'a' ELSE 
elemtyp.typtype END AS elemtyptype
       FROM (
           SELECT typ.oid, typnamespace, typname, typrelid, typnotnull, 
relkind, typelem AS elemoid,
               CASE WHEN proc.proname='array_recv' THEN 'a' ELSE typ.typtype 
END AS typtype,
               CASE
                   WHEN proc.proname='array_recv' THEN typ.typelem
   
                   WHEN typ.typtype='d' THEN typ.typbasetype
               END AS elemtypoid
           FROM pg_type AS typ
           LEFT JOIN pg_class AS cls ON (cls.oid = typ.typrelid)
           LEFT JOIN pg_proc AS proc ON proc.oid = typ.typreceive
   
       ) AS typ
       LEFT JOIN pg_type AS elemtyp ON elemtyp.oid = elemtypoid
       LEFT JOIN pg_class AS elemcls ON (elemcls.oid = elemtyp.typrelid)
       LEFT JOIN pg_proc AS elemproc ON elemproc.oid = elemtyp.typreceive
   ) AS typ_and_elem_type
   JOIN pg_namespace AS ns ON (ns.oid = typnamespace)
   WHERE
       typtype IN ('b', 'r', 'e', 'd') OR -- Base, range, enum, domain
       (typtype = 'c' AND relkind='c') OR -- User-defined free-standing 
composites (not table composites) by default
       (typtype = 'p' AND typname IN ('record', 'void')) OR -- Some special 
supported pseudo-types
       (typtype = 'a' AND (  -- Array of...
           elemtyptype IN ('b', 'r', 'e', 'd') OR -- Array of base, range, 
enum, domain
           (elemtyptype = 'p' AND elemtypname IN ('record', 'void')) OR -- 
Arrays of special supported pseudo-types
           (elemtyptype = 'c' AND elemrelkind='c') -- Array of user-defined 
free-standing composites (not table composites) by default
       ))
   ORDER BY ord
   line 1:0 no viable alternative at input '-'
   line 1:0 mismatched input '-' expecting {SELECT, INSERT, UPDATE, DELETE, 
CREATE, ALTER, DROP, TRUNCATE, GRANT, REVOKE, SET, BEGIN, COMMIT, ROLLBACK, 
SAVEPOINT, CALL, START, RESET, SHOW}
   [ERROR] 11:54:00.444 [pool-12-thread-1] o.a.s.s.f.c.CommandExecutorTask - 
Exception occur:
   org.apache.shardingsphere.sql.parser.exception.SQLParsingException: 
Unsupported SQL of `-- Load enum fields
   SELECT pg_type.oid, enumlabel
   FROM pg_enum
   JOIN pg_type ON pg_type.oid=enumtypid
   ORDER BY oid`
           at 
org.apache.shardingsphere.sql.parser.core.parser.SQLParserEngine.parse(SQLParserEngine.java:71)
           at 
org.apache.shardingsphere.sql.parser.core.SQLParseKernel.parse(SQLParseKernel.java:58)
           at 
org.apache.shardingsphere.sql.parser.SQLParseEngine.parse0(SQLParseEngine.java:68)
           at 
org.apache.shardingsphere.sql.parser.SQLParseEngine.parse(SQLParseEngine.java:50)
           at 
org.apache.shardingsphere.shardingproxy.frontend.postgresql.command.query.binary.parse.PostgreSQLComParseExecutor.execute(PostgreSQLComParseExecutor.java:53)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:90)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:70)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
   [ERROR] 11:54:00.445 [pool-12-thread-1] o.a.s.s.f.c.CommandExecutorTask - 
Exception occur:
   java.lang.NullPointerException: null
           at 
org.apache.shardingsphere.shardingproxy.transport.postgresql.packet.command.query.binary.bind.PostgreSQLComBindPacket.<init>(PostgreSQLComBindPacket.java:59)
           at 
org.apache.shardingsphere.shardingproxy.transport.postgresql.packet.command.PostgreSQLCommandPacketFactory.newInstance(PostgreSQLCommandPacketFactory.java:57)
           at 
org.apache.shardingsphere.shardingproxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandPacket(PostgreSQLCommandExecuteEngine.java:54)
           at 
org.apache.shardingsphere.shardingproxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.getCommandPacket(PostgreSQLCommandExecuteEngine.java:45)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:88)
           at 
org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:70)
           at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
           at java.lang.Thread.run(Unknown Source)
   
   ```
   
   Env:
   -------------------------------------------------------------
    PostgreSQL 10.11, compiled by Visual C++ build 1800, 64-bit
    Npgsql 4.1.3.1
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to