-
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
workload/schemachange: add fk constraints and type improvements #58065
workload/schemachange: add fk constraints and type improvements #58065
Conversation
137e3a0
to
5aba7a0
Compare
13c4fb8
to
3992d74
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.
Reviewed 4 of 4 files at r1, 2 of 2 files at r2, 1 of 1 files at r3, 1 of 1 files at r4.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @jayshrivastava)
pkg/workload/schemachange/error_screening.go, line 586 at r1 (raw file):
} func violatesFkConstraintsHelper(
This could use a better name and a comment.
pkg/workload/schemachange/operation_generator.go, line 321 at r1 (raw file):
func (og *operationGenerator) addForeignKeyConstraint(tx *pgx.Tx) (string, error) { // Use og.produceError() to determine if errors will be produced due to the column being generated
Is this comment stale?
pkg/workload/schemachange/type_resolver.go, line 36 at r3 (raw file):
) (*types.T, error) { // An explicit schema indicates the type is a user defined enum type.
that's subtle and doesn't need to be the case. Comment on this function if you're going with that.
pkg/workload/schemachange/type_resolver.go, line 44 at r3 (raw file):
AND typcategory = 'E' AND typname = $1 AND nspname = $2
nit: weird indentation
pkg/workload/schemachange/type_resolver.go, line 46 at r3 (raw file):
AND nspname = $2 ORDER BY enumsortorder`, name.Object(), name.Schema()) fmt.Println(err, "ASDFASDF")
remove
3992d74
to
bd59fd8
Compare
addForeignKeyConstraint adds a single, non-composite, foreign key relation between two random columns. Release note: None
The addUniqueConstraint op adds a unique constraint on a single column. Release note: None
Previously, the workload was failing because, in certain situations, it would expect certain type errors and they would not occur. This was due to the type resolver incorrectly resolving non user-defined types as enums. This change adds some logic to properly resolve non user-defined types by OID. Closes: cockroachdb#57993 Release note: None
bd59fd8
to
4c9ef83
Compare
Previously, creating a sequence that was owned by a column from a non existing table would cause an unexpected pgcode.UndefinedTable. This change ensures that this error is expected when the table does not exist. Release note: None
4c9ef83
to
0265965
Compare
bors r=ajwerner |
Build succeeded: |
workload/schemachange: implement addForeignKeyConstraint op
addForeignKeyConstraint adds a single, non-composite, foreign key relation
between two random columns.
Closes: #57472
Release note: None
workload/schemachange: implement addUniqueConstraint op
The addUniqueConstraint op adds a unique constraint on a single
column.
Release note: None
workload/schemachange: add oid type resolution to type resolver
Previously, the workload was failing because, in certain situations,
it would expect certain type errors and they would not occur. This was due
to the type resolver incorrectly resolving non user-defined types as enums.
This change adds some logic to properly resolve non user-defined types
by OID.
Closes: #57993
Release note: None
workload/schemachange: expect undefined table in create sequence
Previously, creating a sequence that was owned by a column
from a non existing table would cause an unexpected
pgcode.UndefinedTable. This change ensures that this error
is expected when the table does not exist.
Release note: None