-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_catalog: indoption was not encoded correctly
Previously, the indoption field inside pg_index was encoded incorrectly, which could cause problems for binary clients. Specifically, an int8 was being sent across the wire, then int2vectors are supposed to be made of int2. To address this, this patch ensures that an int2 is used and adds assertion inside the conversion code (for int2vector) to avoid future problems. Fixes: #111907 Release note (bug fix): indoption inside pg_index was not properly encoded, causing clients to be unable to decode it as int2vector.
- Loading branch information
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This test validates that int2vector produces an array | ||
# of int2 objects. Previously CRDB incorrectly was returning | ||
# int8 values as observed in #111907, which would cause problems | ||
# for binary pgwire clients. | ||
send | ||
Query {"String": "DROP TABLE IF EXISTS t"} | ||
Query {"String": "CREATE TABLE t (a int primary key, b text)"} | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
ReadyForQuery | ||
---- | ||
{"Type":"CommandComplete","CommandTag":"DROP TABLE"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
{"Type":"CommandComplete","CommandTag":"CREATE TABLE"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} | ||
|
||
send | ||
Parse {"Query": "select i.indoption from pg_index i join pg_class c on i.indrelid = c.oid where c.relname = 't';"} | ||
Bind {"ParameterFormatCodes": [0], "ResultFormatCodes": [1]} | ||
Execute | ||
Sync | ||
---- | ||
|
||
until | ||
ReadyForQuery | ||
---- | ||
{"Type":"ParseComplete"} | ||
{"Type":"BindComplete"} | ||
{"Type":"DataRow","Values":[{"binary":"0000000100000000000000150000000100000001000000020002"}]} | ||
{"Type":"CommandComplete","CommandTag":"SELECT 1"} | ||
{"Type":"ReadyForQuery","TxStatus":"I"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters