tuohai666 opened a new issue #8445: URL: https://github.com/apache/shardingsphere/issues/8445
For ShardingSphere-Proxy's PostgreSQL protocol implement, we record the SQL command type for the CommandCompletePacket. In brief, users can get a readable prompt after execute an SQL:  Types that Proxy supports for now: ``` SELECT INSERT UPDATE DELETE ``` That's not enough, maybe we should implement the entire types according to: ``` 1. PostgreSQL protocol. 2. JDBC codes. 3. PostgreSQL server codes. ``` **Option 1** As the protocol doc: https://www.postgresql.org/docs/13/protocol-message-formats.html CommandComplete (B) Byte1('C') Identifies the message as a command-completed response. Int32 Length of message contents in bytes, including self. ``` CommandComplete (B) Byte1('C') Identifies the message as a command-completed response. Int32 Length of message contents in bytes, including self. String The command tag. This is usually a single word that identifies which SQL command was completed. For an INSERT command, the tag is INSERT oid rows, where rows is the number of rows inserted. oid used to be the object ID of the inserted row if rows was 1 and the target table had OIDs, but OIDs system columns are not supported anymore; therefore oid is always 0. For a DELETE command, the tag is DELETE rows where rows is the number of rows deleted. For an UPDATE command, the tag is UPDATE rows where rows is the number of rows updated. For a SELECT or CREATE TABLE AS command, the tag is SELECT rows where rows is the number of rows retrieved. For a MOVE command, the tag is MOVE rows where rows is the number of rows the cursor's position has been changed by. For a FETCH command, the tag is FETCH rows where rows is the number of rows that have been retrieved from the cursor. For a COPY command, the tag is COPY rows where rows is the number of rows copied. (Note: the row count appears only in PostgreSQL 8.2 and later.) ``` **Option 2** The **SqlCommandType** of pgjdbc: https://github.com/pgjdbc/pgjdbc ``` public enum SqlCommandType { /** * Use BLANK for empty sql queries or when parsing the sql string is not * necessary. */ BLANK, INSERT, UPDATE, DELETE, MOVE, SELECT, WITH; } ``` **Option 3** Didn't get the codes yet. 1 and 2 are not equivalent, which one should we choose? Does 3 necessary? ---------------------------------------------------------------- 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]
