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

sql: SET default_int_size does not take effect until the next statement batch is parsed #32846

Open
bobvawter opened this issue Dec 5, 2018 · 3 comments
Labels
A-sql-execution Relating to SQL execution. A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@bobvawter
Copy link
Member

bobvawter commented Dec 5, 2018

Tracking issue to follow on option 2 of #26925 (comment)

For docs:

Executing a compound statement such as SET default_int_size='int4'; SELECT 1::INT will use the previous INT size. This happens because statement parsing takes place asynchronously from statement execution. Instead, set default_int_size using connection parameters via your database driver or ensure that SET default_int_size occurs in its own statement.

Jira issue: CRDB-4712

@bobvawter bobvawter added docs-known-limitation A-sql-execution Relating to SQL execution. labels Dec 5, 2018
@knz knz added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Dec 6, 2018
craig bot pushed a commit that referenced this issue Dec 12, 2018
32848: sql: Add default_int_size to control INT alias r=bobvawter a=bobvawter

This is a follow-up from #32831 to support #26925.

The combination of `default_int_size` interacts with
`experimental_serial_normalization`. Sequence types that are ultimately based
on `unique_rowid()` must always be INT8 types in order to hold the returned
values.  Only in the case where `default_int_size=4
experimental_serial_normalization='sql_sequence'` will an INT4 column be
created in response to a SERIAL type.

Release note (sql change): A new session variable `default_int_size` and
cluster setting `sql.defaults.default_int_size` have been added to control how
the INT and SERIAL types are interpreted. The default value, 8, causes the INT
and SERIAL types to be interpreted as aliases for INT8 and SERIAL8, which have
been the historical defaults for CockroachDB.  PostgreSQL clients that expect
INT and SERIAL to be 32-bit values, can set `default_int_size` to 4, which will
cause INT and SERIAL to be aliases for INT4 and SERIAL4.  Please note that due
to issue #32846, `SET default_int_size` does not take effect until the next
statement batch is executed.



Co-authored-by: Bob Vawter <bob@cockroachlabs.com>
@jseldess
Copy link
Contributor

jseldess commented Nov 4, 2019

Documented in cockroachdb/docs#5785.

@github-actions
Copy link

github-actions bot commented Jun 5, 2021

We have marked this issue as stale because it has been inactive for
18 months. If this issue is still relevant, removing the stale label
or adding a comment will keep it active. Otherwise, we'll close it in
5 days to keep the issue queue tidy. Thank you for your contribution
to CockroachDB!

@knz knz added A-sql-pgcompat Semantic compatibility with PostgreSQL and removed no-issue-activity labels Jun 5, 2021
@knz
Copy link
Contributor

knz commented Jun 5, 2021

still current in 21.1

@jlinder jlinder added the T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-execution Relating to SQL execution. A-sql-pgcompat Semantic compatibility with PostgreSQL C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. docs-done docs-known-limitation T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

4 participants