Skip to content

sql: error on result type changes in prepared statements#16335

Merged
madelynnblue merged 1 commit intocockroachdb:release-1.0from
madelynnblue:cherrypick-16089
Jun 5, 2017
Merged

sql: error on result type changes in prepared statements#16335
madelynnblue merged 1 commit intocockroachdb:release-1.0from
madelynnblue:cherrypick-16089

Conversation

@madelynnblue
Copy link
Copy Markdown
Contributor

Fix a panic when the number of results change in a pgwire prepared
statement. This is not the full fix for this bug, but it is the most
we have decided to do for the 1.0 branch. This adds a few known bugs,
all of which are fixed in the master branch:

  1. Prepared statements of the form INSERT ... RETURNING * where a
    schema change is done after the prepare act inconsistently. They will
    succeed to write the data, but also return an error if the number of
    columns has increased. If the number of columns is the same but the
    types have changed, they will write the data and not return an error.
  2. PREPARE/EXECUTE statements (that is, statements where PREPARE
    and EXECUTE appear in the text of the statement) incorrectly allow
    changes in result types due to schema changes between executions.

Fixes #16062
See #16089 for the full fix

cc @cockroachdb/release

@jseldess I think this needs to be documented in the 1.0 known limitations?

Fix a panic when the number of results change in a pgwire prepared
statement. This is not the full fix for this bug, but it is the most
we have decided to do for the 1.0 branch. This adds a few known bugs,
all of which are fixed in the master branch:

1. Prepared statements of the form `INSERT ... RETURNING *` where a
schema change is done after the prepare act inconsistently. They will
succeed to write the data, but also return an error if the number of
columns has increased. If the number of columns is the same but the
types have changed, they will write the data and not return an error.
2. PREPARE/EXECUTE statements (that is, statements where PREPARE
and EXECUTE appear in the text of the statement) incorrectly allow
changes in result types due to schema changes between executions.

Fixes #16062
See #16089 for the full fix
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 5, 2017

The text of the known limitation must be very clear that even if an error is reported by CockroachDB due to a schema change between prepare and execute, the data is still inserted/upserted into the database.

@knz
Copy link
Copy Markdown
Contributor

knz commented Jun 5, 2017

LGTM otherwise


Review status: 0 of 2 files reviewed at latest revision, all discussions resolved, all commit checks successful.


Comments from Reviewable

@madelynnblue madelynnblue merged commit 476b2a3 into cockroachdb:release-1.0 Jun 5, 2017
@madelynnblue madelynnblue deleted the cherrypick-16089 branch June 5, 2017 20:29
@jseldess
Copy link
Copy Markdown
Contributor

jseldess commented Jun 5, 2017

Thanks, @mjibson and @knz, I'll add this known limitation to the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants