-
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: code to check whether a sequence exists is bad #72820
Labels
A-schema-descriptors
Relating to SQL table/db descriptor handling.
A-sql-name-resolution
SQL name resolution rules and CTEs.
A-sql-sequences
Sequence handling in SQL
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Comments
ajwerner
added
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
A-sql-sequences
Sequence handling in SQL
A-sql-name-resolution
SQL name resolution rules and CTEs.
A-schema-descriptors
Relating to SQL table/db descriptor handling.
labels
Nov 16, 2021
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this issue
Nov 23, 2021
Prior to this change there was a bug when a type name conflicted with a sequence name (cockroachdb#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes cockroachdb#72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
ajwerner
added a commit
to ajwerner/cockroach
that referenced
this issue
Nov 24, 2021
Prior to this change there was a bug when a type name conflicted with a sequence name (cockroachdb#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes cockroachdb#72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
exalate-issue-sync
bot
added
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
and removed
T-sql-schema-deprecated
Use T-sql-foundations instead
labels
May 10, 2023
This was referenced Dec 19, 2023
chrisseto
added a commit
to chrisseto/cockroach
that referenced
this issue
Dec 20, 2023
This commit adds support for attaching comments to various schema elements in the RSW. Notably, commenting on databases has been omitted as the workload operates within the scope of a given database. Unfortunately, `COMMENT ON` will consistently trigger the bug reported in cockroachdb#72820. Therefore it is disabled by default. Epic: CRDB-19168 Informs: CRDB-3265 Informs: cockroachdb#72820 Release note: None
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
Feb 7, 2024
Prior to this change there was a bug when a type name conflicted with a sequence name (cockroachdb#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes cockroachdb#72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
rafiss
added a commit
to rafiss/cockroach
that referenced
this issue
Feb 7, 2024
Prior to this change there was a bug when a type name conflicted with a sequence name (cockroachdb#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes cockroachdb#72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
craig bot
pushed a commit
that referenced
this issue
Feb 8, 2024
118781: sql: add server.max_open_transactions_per_gateway cluster setting r=rafiss a=rafiss informs #110272 Release note (sql change): Added the server.max_open_transactions_per_gateway cluster setting. When set to a non-negative value, then non-admin users cannot execute a query if the number of transactions open on the current gateway node is already at the configured limit. 118861: sql: fix bug with type name conflict, allow resolving any object r=rafiss a=rafiss Prior to this change there was a bug when a type name conflicted with a sequence name (#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go replaces #72824 fixes #72820 fixes #118753 fixes #116795 Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name. Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
cockroach-dev-inf
pushed a commit
that referenced
this issue
Feb 8, 2024
Prior to this change there was a bug when a type name conflicted with a sequence name (#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes #72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
cockroach-dev-inf
pushed a commit
that referenced
this issue
Feb 8, 2024
Prior to this change there was a bug when a type name conflicted with a sequence name (#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes #72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
wenyihu6
pushed a commit
to wenyihu6/cockroach
that referenced
this issue
Feb 21, 2024
Prior to this change there was a bug when a type name conflicted with a sequence name (cockroachdb#72820). This resolves that problem by adding logic to resolve any sort of object with a given name. It also removes a bad method from sql/resolver.go Fixes cockroachdb#72820. Release note (bug fix): Fixed a bug which caused an inscrutable error when a sequence name allocated by `SERIAL` conflicted with an existing type name.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-schema-descriptors
Relating to SQL table/db descriptor handling.
A-sql-name-resolution
SQL name resolution rules and CTEs.
A-sql-sequences
Sequence handling in SQL
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-foundations
SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Describe the problem
The code to check whether a sequence exists uses descriptor resolution APIs which indicate a name is not in use when it's in use by a type.
cockroach/pkg/sql/serial.go
Lines 94 to 97 in 3e4a440
To Reproduce
Leads to this inscrutible error:
Expected behavior
We call the sequence
t_t_seq1
Additional context
The deeper problem here is that we lack primitives to ask whether an object (postgres would say
relation
) exists with a given name without specifying what type of object we want. This problem lies here:cockroach/pkg/sql/sem/tree/name_resolution.go
Lines 253 to 262 in 3e4a440
We probably need some sort of
AnyObject
here. That's all fine and good, but it gets a tad tricky here when we want to construct a name for the purposes of errors.cockroach/pkg/sql/sem/tree/name_resolution.go
Lines 264 to 267 in 3e4a440
At a deeper level, I don't really understand what value we get out of having different types for
TableName
andTypeName
.Jira issue: CRDB-11305
Epic CRDB-35306
The text was updated successfully, but these errors were encountered: