Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend PgQueryProtobuf.len to machine word size
The len field is expected to be size_t from the protobuf side (see the definition of pg_query__parse_result__unpack()). Also, clients are expecting to be able to use size_t-like types when filling the PgQueryProtobuf structure. This is how this problem was discovered in pglast: deparse_protobuf(parse_sql_protobuf('select 1')) would always return '' on big-endian machines. deparse_protobuf() populated a 64-bit machine-word-sized len field, but libpg-query would only read an "int" from it, which is 32-bit only even on 64-bit machines. On big-endian machines, the "wrong" half of the integer is read, so the len is effectively always zeros. Close lelit/pglast#114.
- Loading branch information