Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Prevent column shift during insert#1930

Merged
findepi merged 1 commit intotrinodb:masterfrom
kasiafi:015FixInsert
Nov 6, 2019
Merged

Prevent column shift during insert#1930
findepi merged 1 commit intotrinodb:masterfrom
kasiafi:015FixInsert

Conversation

@kasiafi
Copy link
Member

@kasiafi kasiafi commented Nov 1, 2019

This change in BaseJdbcClient adds explicit enumeration of target columns in the final phase of insert. Before, the columns of the temporary table were copied into the leftmost columns of the target table. It caused a failure or incorrect results when a column of unsupported type was encountered.

@cla-bot cla-bot bot added the cla-signed label Nov 1, 2019
Copy link
Member

@findepi findepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify that y is indeed not supported.
Maybe replace

assertQuery("SELECT x, z FROM test_insert_not_supported_column", "SELECT 123, 'test'");

with

assertQuery("SELECT * FROM test_insert_not_supported_column", "SELECT 123, 'test'");

...
but having explicit check using information_schema.columns would be better

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testInsertInPresenceOfNotSupportedColumn?

also, add a similar test case for mysql, sql server too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this comment is redundant (same in other tests)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • remove space after table name
  • rename the table to sth like test_insert_not_supported_column_present

This change adds explicit enumeration of target columns
in the final phase of insert. Before, the columns of the
temporary table were copied into the leftmost columns of
the target table. It caused a failure or incorrect results
when a column of unsupported type was encountered.
@kasiafi
Copy link
Member Author

kasiafi commented Nov 5, 2019

@findepi, are there any changes required?

@findepi findepi merged commit 828dbd7 into trinodb:master Nov 6, 2019
@findepi
Copy link
Member

findepi commented Nov 6, 2019

Merged, thanks!

@findepi findepi added this to the 325 milestone Nov 6, 2019
@findepi findepi mentioned this pull request Nov 6, 2019
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants