Fix potential infinite loop in CDB_QueryStatements
This fix was already present at one point in cartodb/lib/sql (where the code was copied from) but in a different branch than the one the code was initially copied from. The fix depends on plpython language which becomes a new dependency.
This commit is contained in:
@@ -26,3 +26,38 @@ INSER INTO "my''""t" values ('''','""'';;');
|
||||
SELECT $qu;oted$ hi $qu;oted$;
|
||||
$the_param$) as statement )
|
||||
SELECT '5', row_number() over (), statement FROM q;
|
||||
|
||||
WITH q AS ( SELECT CDB_QueryStatements($the_param$
|
||||
SELECT
|
||||
1 ; SELECT
|
||||
2
|
||||
$the_param$) as statement )
|
||||
SELECT '6', row_number() over (), statement FROM q;
|
||||
|
||||
-- This is an insane input, illegal sql
|
||||
-- we are really only testing that it does not
|
||||
-- take forever to process..
|
||||
-- The actual result is not correct, so if the function
|
||||
-- ever gets fixed check if it's better
|
||||
WITH q AS ( SELECT CDB_QueryStatements($the_param$
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/a
|
||||
$b$
|
||||
$c$d
|
||||
;
|
||||
$the_param$) as statement )
|
||||
SELECT '7', row_number() over (), statement FROM q;
|
||||
|
||||
|
||||
WITH q AS ( SELECT CDB_QueryStatements($the_param$
|
||||
SELECT $quoted$ hi
|
||||
$quoted$;
|
||||
$the_param$) as statement )
|
||||
SELECT '8', row_number() over (), statement FROM q;
|
||||
|
||||
@@ -7,3 +7,13 @@
|
||||
4|4|SELECT 5
|
||||
5|1|INSER INTO "my''""t" values ('''','""'';;')
|
||||
5|2|SELECT $qu;oted$ hi $qu;oted$
|
||||
6|1|SELECT
|
||||
1
|
||||
6|2|SELECT
|
||||
2
|
||||
7|1|/a
|
||||
7|2|b
|
||||
7|3|c
|
||||
7|4|d
|
||||
8|1|SELECT $quoted$ hi
|
||||
$quoted$
|
||||
|
||||
Reference in New Issue
Block a user