Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sem/tree: fix LIKE ESCAPE when the pattern contains Unicode symbols #44633

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

yuzefovich
Copy link
Member

Previously, we were incorrectly updating the pattern when the current
character was Unicode symbol that had the width of more than a single
byte.

Fixes: #44621.

Release note (bug fix): Previously, running a query with LIKE operator
using custom ESCAPE symbol when the pattern contained Unicode characters
could result in an internal error in CockroachDB, and now this has been
fixed.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@solongordon solongordon left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @solongordon and @yuzefovich)


pkg/sql/sem/tree/testdata/eval/like, line 423 at r1 (raw file):

like_escape('a', '꧕', '�')
----
false

Would it be useful to add a positive test case here too?

Previously, we were incorrectly updating the pattern when the current
character was Unicode symbol that had the width of more than a single
byte.

Release note (bug fix): Previously, running a query with LIKE operator
using custom ESCAPE symbol when the pattern contained Unicode characters
could result in an internal error in CockroachDB, and now this has been
fixed.
Copy link
Member Author

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

TFTR!

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @solongordon)


pkg/sql/sem/tree/testdata/eval/like, line 423 at r1 (raw file):

Previously, solongordon (Solon) wrote…

Would it be useful to add a positive test case here too?

It can't hurt, done.

craig bot pushed a commit that referenced this pull request Feb 3, 2020
43047: client,kv: new savepoint API r=andreimatei a=knz

This patch introduces the KV savepoint API as discussed in the
savepoints RFC:

```go
	// CreateSavepoint establishes a savepoint.
	// This method is only valid when called on RootTxns.
	CreateSavepoint(context.Context) (SavepointToken, error)

	// RollbackToSavepoint rolls back to the given savepoint. The
	// savepoint must not have been rolled back or released already.
	// All savepoints "under" the savepoint being rolled back
	// are also rolled back and their token must not be used any more.
	// This method is only valid when called on RootTxns.
	RollbackToSavepoint(context.Context, SavepointToken) error

	// ReleaseSavepoint releases the given savepoint. The savepoint
	// must not have been rolled back or released already.
	// All savepoints "under" the savepoint being released
	// are also released and their token must not be used any more.
	// This method is only valid when called on RootTxns.
	ReleaseSavepoint(context.Context, SavepointToken) error
```

Ths initial implementation does not (yet) enable clients to roll back over errors.

Release note: None

44626: workload/tpch: unskip query 12 r=yuzefovich a=yuzefovich

Previously, query 12 was skipped because the results returned by lib/pq
didn't match the expected output. The issue is that the driver returned
[]byte for decimals whereas we expected a string value and `fmt.Sprint`
was giving us the ASCII codes of the digits instead of printing out the
number. This is fixed by checking whether the returned value is []byte,
and if so, converting it to string directly.

Release note: None

44633: sem/tree: fix LIKE ESCAPE when the pattern contains Unicode symbols r=yuzefovich a=yuzefovich

Previously, we were incorrectly updating the pattern when the current
character was Unicode symbol that had the width of more than a single
byte.

Fixes: #44621.

Release note (bug fix): Previously, running a query with LIKE operator
using custom ESCAPE symbol when the pattern contained Unicode characters
could result in an internal error in CockroachDB, and now this has been
fixed.

Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Feb 3, 2020

Build succeeded

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.

Internal error for ILIKE_ESCAPE and special characters
3 participants