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: can't add column to table and insert values in the same transaction #31463

Open
pmneo opened this issue Oct 16, 2018 · 4 comments
Open

sql: can't add column to table and insert values in the same transaction #31463

pmneo opened this issue Oct 16, 2018 · 4 comments
Labels
A-schema-changes A-schema-transactional A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@pmneo
Copy link

pmneo commented Oct 16, 2018

Tested with 2.1.0-beta20181015:

start transaction;
alter table my_table add column test varchar(100);
select test from my_table;
pq: column "test" does not exist

Those statements works pretty fine with pgsql ...

This may be related with #24626

Jira issue: CRDB-4791

@knz
Copy link
Contributor

knz commented Oct 19, 2018

@pmneo as documented CockroachDB performs DDL statements asynchronously (at the end of the current transaction) so the behavior you observe is expected. This is a known difference from PostgreSQL that was introduced to make CockroachDB able to run schema changes faster.

Can you provide us some context about your use case? What makes you want to use this feature in that way? Is it not possible to issue the statements in separate transactions?

@knz knz added C-investigation Further steps needed to qualify. C-label will change. A-sql-pgcompat Semantic compatibility with PostgreSQL O-community Originated from the community A-schema-changes labels Oct 19, 2018
@pmneo
Copy link
Author

pmneo commented Oct 22, 2018

This is because my liquibase migration scripts add some columns and fill them with some default values.

This scripts works fine with most other databases like mysql, mariadb, mssql, oracle, pgsql, hsql, ....

@knz
Copy link
Contributor

knz commented Oct 22, 2018

cc @awoods187 for prioritization (LiquiBase compatiblity #13991)

@knz
Copy link
Contributor

knz commented Oct 22, 2018

cc @awoods187 for prioritization (LiquiBase compatiblity #13991)

@cockroachdb cockroachdb deleted a comment from knz Oct 22, 2018
@cockroachdb cockroachdb deleted a comment from knz Oct 22, 2018
@jlinder jlinder added the T-sql-schema-deprecated Use T-sql-foundations instead label Jun 16, 2021
@exalate-issue-sync 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-schema-changes A-schema-transactional A-sql-pgcompat Semantic compatibility with PostgreSQL C-investigation Further steps needed to qualify. C-label will change. O-community Originated from the community T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

5 participants