Skip to content

Ruby repeated uint64 values error out with "wrong argument type Hash" #8935

Closed
@stanhu

Description

@stanhu

What version of protobuf and what language are you using?
Version: 3.18.0.rc.1, tried master too
Language: Ruby

What operating system (Linux, Windows, ...) and version?

What runtime / compiler are you using (e.g., python version or gcc version)

Ruby 2.7.4

What did you do?
Steps to reproduce the behavior:

  1. Checkout https://github.com/pganalyze/pg_query
  2. Bump google-protobuf version to 3.18.0.rc.1.
  3. Run bundle exec rake.

We see:

An error occurred while loading ./spec/lib/truncate_spec.rb.
Failure/Error: repeated :notnulls, :uint64, 11, json_name: "notnulls"

TypeError:
  wrong argument type Hash (expected String)
# ./lib/pg_query/pg_query_pb.rb:295:in `repeated'
# ./lib/pg_query/pg_query_pb.rb:295:in `block (3 levels) in <top (required)>'
# ./lib/pg_query/pg_query_pb.rb:284:in `instance_eval'
# ./lib/pg_query/pg_query_pb.rb:284:in `add_message'
# ./lib/pg_query/pg_query_pb.rb:284:in `block (2 levels) in <top (required)>'
# ./lib/pg_query/pg_query_pb.rb:7:in `instance_eval'
# ./lib/pg_query/pg_query_pb.rb:7:in `add_file'
# ./lib/pg_query/pg_query_pb.rb:7:in `block in <top (required)>'
# ./lib/pg_query/pg_query_pb.rb:6:in `instance_eval'
# ./lib/pg_query/pg_query_pb.rb:6:in `build'
# ./lib/pg_query/pg_query_pb.rb:6:in `<top (required)>'
# ./lib/pg_query.rb:4:in `require'
# ./lib/pg_query.rb:4:in `<top (required)>'
# ./spec/spec_helper.rb:1:in `require'
# ./spec/spec_helper.rb:1:in `<top (required)>'
# ./spec/lib/truncate_spec.rb:1:in `require'
# ./spec/lib/truncate_spec.rb:1:in `<top (required)>'
No examples found.

The notnulls definition is here (https://github.com/pganalyze/libpg_query/blob/802caf25b78ddeb8ade13cd4804d772b6d986eb3/protobuf/pg_query.proto#L307-L322):

message TableFunc
{
  repeated Node ns_uris = 1 [json_name="ns_uris"];
  repeated Node ns_names = 2 [json_name="ns_names"];
  Node docexpr = 3 [json_name="docexpr"];
  Node rowexpr = 4 [json_name="rowexpr"];
  repeated Node colnames = 5 [json_name="colnames"];
  repeated Node coltypes = 6 [json_name="coltypes"];
  repeated Node coltypmods = 7 [json_name="coltypmods"];
  repeated Node colcollations = 8 [json_name="colcollations"];
  repeated Node colexprs = 9 [json_name="colexprs"];
  repeated Node coldefexprs = 10 [json_name="coldefexprs"];
  repeated uint64 notnulls = 11 [json_name="notnulls"];
  int32 ordinalitycol = 12 [json_name="ordinalitycol"];
  int32 location = 13 [json_name="location"];
}

What did you expect to see

No errors.

What did you see instead?

  wrong argument type Hash (expected String)

The Ruby-compiled .proto yields:

      optional :ordinalitycol, :int32, 12, json_name: "ordinalitycol"

@haberman It seems options is no longer a parameter:

def repeated(name, type, number, type_class = nil)
internal_add_field(:LABEL_REPEATED, name, type, number, type_class, nil)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions