diff --git a/pkg/sql/logictest/testdata/logic_test/builtin_function b/pkg/sql/logictest/testdata/logic_test/builtin_function index 6a22923eb39..966cd754b46 100644 --- a/pkg/sql/logictest/testdata/logic_test/builtin_function +++ b/pkg/sql/logictest/testdata/logic_test/builtin_function @@ -2989,7 +2989,7 @@ select crdb_internal.json_to_pb('cockroach.sql.sqlbase.Descriptor', crdb_interna ---- true -query error pq: crdb_internal.json_to_pb\(\): invalid proto JSON: unmarshaling json to cockroach.sql.sqlbase.Descriptor: unknown field "__redacted__" in descpb.Descriptor +query error pq: crdb_internal.json_to_pb\(\): invalid proto JSON: unmarshaling to cockroach.sql.sqlbase.Descriptor json: .+ unknown field "__redacted__" in descpb.Descriptor select crdb_internal.json_to_pb('cockroach.sql.sqlbase.Descriptor', crdb_internal.pb_to_json('cockroach.sql.sqlbase.Descriptor', descriptor, true, true)) = descriptor from system.descriptor where id = 1 subtest regexp_split diff --git a/pkg/sql/protoreflect/utils.go b/pkg/sql/protoreflect/utils.go index 643f928e9de..ff75aa34f31 100644 --- a/pkg/sql/protoreflect/utils.go +++ b/pkg/sql/protoreflect/utils.go @@ -123,8 +123,9 @@ func MessageToJSON(msg protoutil.Message, flags FmtFlags) (jsonb.JSON, error) { // Returns serialized byte representation of the protocol message. func JSONBMarshalToMessage(input jsonb.JSON, target protoutil.Message) ([]byte, error) { json := &jsonpb.Unmarshaler{} - if err := json.Unmarshal(strings.NewReader(input.String()), target); err != nil { - return nil, errors.Wrapf(err, "unmarshaling json to %s", proto.MessageName(target)) + jsonString := input.String() + if err := json.Unmarshal(strings.NewReader(jsonString), target); err != nil { + return nil, errors.Wrapf(err, "unmarshaling to %s json: %s", proto.MessageName(target), jsonString) } data, err := protoutil.Marshal(target) if err != nil {