- edited description
Insert of multiple values that contain an unknown column don't trigger an exception
Inserting just one value triggers the CompileError 'Unconsumed column names' just fine.
Will provide patch shortly.
Test case attached. Before fix:
$ python2 unknown_columns.py
Expected fail (single value): CompileError('Unconsumed column names: unknown_column',)
Traceback (most recent call last):
File "unknown_columns.py", line 30, in <module>
raise RuntimeError("(multiple values): shouldn't hit here")
RuntimeError: (multiple values): shouldn't hit here
After fix:
$ python2 unknown_columns.py
Expected fail (single value): CompileError('Unconsumed column names: unknown_column',)
Expected fail (multiple values): CompileError('Unconsumed column names: unknown_column',)
Comments (11)
-
reporter -
repo owner this is by design, last i looked at this the complexity of checking every dictionary would render far too much time spent on a case that's supposed to be optimized. im a little surprised i dont see this documented though, I'm pretty sure there's a note about it somewhere but we can add more.
-
reporter I agree that it's probably not worth the effort to check all elements that are being inserted.
Everywhere else in this function, though, there's an attempt made to use the first element of the values list to stand for all potential statement parameters; that it's not the case in this one spot feels like an oversight.
-
repo owner yah sorry I was incorrect, the "check only the first entry" is for conn.execute(stmt, values). With this one, you have the bad entry in the first element as well so that should definitely raise! the fix seems to repair a definite oversight.
-
repo owner - changed status to resolved
Raise exception when we have multiple values with an unknown column. Fixes
#3666.→ <<cset 399f92cd116b>>
-
repo owner → <<cset 3d83e1639e13>>
-
repo owner - move out unconsumed names tests from test_compiler out to test_insert, test_update
- establish consistent names between existing unconsumed names tests and new ones
added per ref
#3666
→ <<cset 6b7c207801d8>>
-
repo owner Raise exception when we have multiple values with an unknown column. Fixes
#3666.(cherry picked from commit 399f92cd116b747f742b919ac9a3e79eb0637e8a)
→ <<cset 59677e82fb23>>
-
repo owner (cherry picked from commit 3d83e1639e1325af67d2bba390bd7c40838380b9)
→ <<cset 78364b7037e2>>
-
repo owner - move out unconsumed names tests from test_compiler out to test_insert, test_update
- establish consistent names between existing unconsumed names tests and new ones
added per ref
#3666
(cherry picked from commit 6b7c207801d826db872aeda02e7c7b531df68034)
→ <<cset d2adf9411591>>
-
reporter Awesome, thank you! I'm ashamed to admit this has bitten me too many times (in unit tests especially), so this will make my life better.
- Log in to comment