diff --git a/pkg/sql/conn_executor_prepare.go b/pkg/sql/conn_executor_prepare.go index 2da1e78528cd..f6bb0e0c5104 100644 --- a/pkg/sql/conn_executor_prepare.go +++ b/pkg/sql/conn_executor_prepare.go @@ -599,8 +599,10 @@ func (ex *connExecutor) execDescribe( res.SetPortalOutput(ctx, portal.Stmt.Columns, portal.OutFormats) } default: - return retErr(errors.AssertionFailedf( - "unknown describe type: %s", errors.Safe(descCmd.Type))) + return retErr(pgerror.Newf( + pgcode.ProtocolViolation, + "invalid DESCRIBE message subtype %d", errors.Safe(byte(descCmd.Type)), + )) } return nil, nil } diff --git a/pkg/sql/pgwire/testdata/pgtest/portals b/pkg/sql/pgwire/testdata/pgtest/portals index def589e3c10c..8a9a5123650f 100644 --- a/pkg/sql/pgwire/testdata/pgtest/portals +++ b/pkg/sql/pgwire/testdata/pgtest/portals @@ -1394,3 +1394,29 @@ ReadyForQuery {"Type":"DataRow","Values":[{"text":"2"}]} {"Type":"CommandComplete","CommandTag":"FETCH 2"} {"Type":"ReadyForQuery","TxStatus":"T"} + +send +Query {"String": "ROLLBACK"} +---- + +until +ReadyForQuery +---- +{"Type":"CommandComplete","CommandTag":"ROLLBACK"} +{"Type":"ReadyForQuery","TxStatus":"I"} + +send +Parse {"Query": "SELECT * FROM generate_series(1, 4)"} +Describe +Bind +Execute +Sync +---- + +until keepErrMessage +ErrorResponse +ReadyForQuery +---- +{"Type":"ParseComplete"} +{"Type":"ErrorResponse","Code":"08P01","Message":"invalid DESCRIBE message subtype 0"} +{"Type":"ReadyForQuery","TxStatus":"I"}