-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: fix index visibility parsing for small values #109697
sql: fix index visibility parsing for small values #109697
Conversation
b4bf1f4
to
4a89d98
Compare
@@ -1059,7 +1060,7 @@ func (og *operationGenerator) createIndex(ctx context.Context, tx pgx.Tx) (*opSt | |||
Unique: og.randIntn(4) == 0, // 25% UNIQUE | |||
Inverted: og.randIntn(10) == 0, // 10% INVERTED | |||
IfNotExists: og.randIntn(2) == 0, // 50% IF NOT EXISTS | |||
Invisibility: 1 - visibility, // 5% NOT VISIBLE | |||
Invisibility: visibility, // 5% NOT VISIBLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: i think this should still be 1 - visibility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed this above.
70ee664
to
5bb41ae
Compare
This commit updates the parser and AST to keep track of whether or not an index `VISIBILITY` float was provided in a `CREATE TABLE`, `CREATE INDEX`, or `ALTER INDEX` statement. This allows the statements to be round-tripped correctly with very low float values that would be rounded to zero and change the `VISIBILITY` clause into `NOT VISIBLE`. Fixes cockroachdb#108083 Release note: None
5bb41ae
to
67f9e00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice fix!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @herkolategan and @smg260)
TFTR! bors r+ |
Build succeeded: |
This commit updates the parser and AST to keep track of whether or not
an index
VISIBILITY
float was provided in aCREATE TABLE
,CREATE INDEX
, orALTER INDEX
statement. This allows the statementsto be round-tripped correctly with very low float values that would be
rounded to zero and change the
VISIBILITY
clause intoNOT VISIBLE
.Fixes #108083
Release note: None