Skip to content

sql: support binary format for all arrays#23126

Merged
justinj merged 1 commit intocockroachdb:masterfrom
justinj:binary-arrays
Feb 28, 2018
Merged

sql: support binary format for all arrays#23126
justinj merged 1 commit intocockroachdb:masterfrom
justinj:binary-arrays

Conversation

@justinj
Copy link
Copy Markdown
Contributor

@justinj justinj commented Feb 26, 2018

Fixes #23063.
Fixes #21433.

More testing probably needed but wanted to get this guy out there, and
see if anyone has any ideas for a nice way to do more large scale
testing than generating test data for every type of array we support?

Release note (bug fix): ARRAYs can now be used with the postgres binary
format.

@justinj justinj requested review from a team and nvb February 26, 2018 23:13
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@hjames9
Copy link
Copy Markdown
Contributor

hjames9 commented Feb 27, 2018

Would this work for creating an array type for jsonb columns by any chance?

Copy link
Copy Markdown
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

plz cherry-pick too

Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

"192.168./10",
}

var arrayUUIDInputs = []string{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test for decimalArrayInputs as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I just took the tests for decimal and arbitrarily grouped them into arrays.

Comment thread pkg/sql/pgwire/types.go
subWriter.putInt32(int32(v.Len()))
subWriter.putInt32(int32(v.Len()))
// Lower bound, we only support a lower bound of 1.
subWriter.putInt32(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious how you caught this. What was failing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests I just added were, haha. But I guess this is a good indicator that nobody really makes use of the lower bound.

@justinj
Copy link
Copy Markdown
Contributor Author

justinj commented Feb 27, 2018

@hjames9 We punted arrays of JSONB values for the meantime because it causes some annoyances with respect to formatting. Out of curiosity - what do you want them for that you couldn't just use a JSONB-level array for?

@hjames9
Copy link
Copy Markdown
Contributor

hjames9 commented Feb 27, 2018 via email

@knz
Copy link
Copy Markdown
Contributor

knz commented Feb 27, 2018 via email

@hjames9
Copy link
Copy Markdown
Contributor

hjames9 commented Feb 28, 2018 via email

Fixes cockroachdb#23063.
Fixes cockroachdb#21433.

Release note (bug fix): ARRAYs can now be used with the postgres binary
format.
@justinj
Copy link
Copy Markdown
Contributor Author

justinj commented Feb 28, 2018

TFTRs!

@justinj justinj merged commit d474dfc into cockroachdb:master Feb 28, 2018
@justinj justinj deleted the binary-arrays branch February 28, 2018 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: unable to provide placeholder values of type uuid[] over pgwire sql/pgwire: support ArrayOid decoding in pgwire binary format

5 participants