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

Ban update statement which can modify the PK column #7710

Closed
st1page opened this issue Feb 6, 2023 · 3 comments
Closed

Ban update statement which can modify the PK column #7710

st1page opened this issue Feb 6, 2023 · 3 comments
Assignees
Labels
good first issue Good for newcomers help wanted Issues that need help from contributors
Milestone

Comments

@st1page
Copy link
Contributor

st1page commented Feb 6, 2023

We can not handle it now, so we need to ban it or the result can make user confused
case 1:

dev=> create table t(k int primary key, cnt int);
CREATE_TABLE
dev=> insert into t values (1,1), (2,2), (3,3);
INSERT 0 3
dev=> UPDATE t SET k = 1;      
UPDATE 3
dev=> select * from t;
 k | cnt 
---+-----
 1 |   1
(1 row)

case 2:

dev=> create table t(k int primary key, cnt int);
CREATE_TABLE
dev=> insert into t values (1,1), (2,2), (3,3);
INSERT 0 3
dev=> UPDATE t SET k = k+1;
UPDATE 3
dev=> select * from t;
 k | cnt 
---+-----
 2 |   1
 3 |   3
 4 |   3
(3 rows)
@st1page st1page added the good first issue Good for newcomers label Feb 6, 2023
@st1page st1page self-assigned this Feb 6, 2023
@github-actions github-actions bot added this to the release-0.1.17 milestone Feb 6, 2023
@st1page st1page added the help wanted Issues that need help from contributors label Feb 6, 2023
@y-wei
Copy link
Contributor

y-wei commented Feb 7, 2023

As for the second case it seems that the returns of update were fine but went wrong when being stored 🧐

dev=> UPDATE t SET k = k+1 returning *;
 k | cnt 
---+-----
 4 |   3
 2 |   1
 3 |   2
(3 rows)

UPDATE 3
dev=> select * from t;
 k | cnt 
---+-----
 3 |   2
 4 |   3
 2 |   2
(3 rows)

@st1page
Copy link
Contributor Author

st1page commented Feb 8, 2023

As for the second case it seems that the returns of update were fine but went wrong when being stored 🧐

Yes, this is because of RisingWave's DML implementation, and the RETURNING clause can not reflect what happens on storage exactly. There is the same issue with the return result of the DML statement which is expected to be the number of the result.

@BugenZhao BugenZhao assigned y-wei and unassigned st1page Mar 14, 2023
@y-wei
Copy link
Contributor

y-wei commented Mar 16, 2023

close as completed #8569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Issues that need help from contributors
Projects
None yet
Development

No branches or pull requests

2 participants