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

geo: allow case insensitive SRID= at the start of EWKT #48551

Merged
merged 1 commit into from
May 8, 2020

Conversation

otan
Copy link
Contributor

@otan otan commented May 7, 2020

PostGIS allows any combination of srid at the beginning of the string.
Follow the same allowance by having a case insensitive HasPrefix.

Release note: None

@otan otan requested review from sumeerbhola and a team May 7, 2020 21:20
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @otan)


pkg/geo/parse.go, line 194 at r1 (raw file):

	}
	for i := 0; i < len(prefix); i++ {
		if unicode.ToLower(rune(str[i])) != unicode.ToLower(rune(prefix[i])) {

It is not clear to me why this is correct in the general utf-8 case (though fine for SRID): my understanding is that the string index returns a byte, not a rune. Can you fix that or add a comment that this works only for a prefix that is ascii.

@otan
Copy link
Contributor Author

otan commented May 8, 2020


pkg/geo/parse.go, line 194 at r1 (raw file):

Previously, sumeerbhola wrote…

It is not clear to me why this is correct in the general utf-8 case (though fine for SRID): my understanding is that the string index returns a byte, not a rune. Can you fix that or add a comment that this works only for a prefix that is ascii.

I'll just cop it and write the builtin myself.

Copy link
Collaborator

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 3 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @otan)


pkg/geo/parse.go, line 194 at r1 (raw file):

Previously, otan (Oliver Tan) wrote…

I'll just cop it and write the builtin myself.

Can you add the following to the function level comment.
// It assumes that the prefix contains only ASCII bytes.


pkg/util/strings.go, line 34 at r2 (raw file):

}

// ToLowerSingleByte returns the the lowercase of a given single ASCII byte.

can you add
// A non ASCII byte is returned unchanged.

and add a couple of non-ascii bytes to the test.

PostGIS allows any combination of `srid` at the beginning of the string.
Follow the same allowance by having a case insensitive HasPrefix.

Release note: None
@otan
Copy link
Contributor Author

otan commented May 8, 2020

tftr!

bors r=sumeerbhola

@craig
Copy link
Contributor

craig bot commented May 8, 2020

Build succeeded

@craig craig bot merged commit 91a8c56 into cockroachdb:master May 8, 2020
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.

None yet

3 participants