One should expect that "toString" output of any statement should be not only functionally identical to the original query text, but can be also used to create another statement with the same result.
For replace statements it works only for simple queries. If query contains sub select it fails
Example:
Original query:
replace a_table (ID,A,B) select A_ID,A,B from b_table
Statement's toString output:
REPLACE a_table (ID, A, B) (SELECT A_ID, A, B FROM b_table WHERE D = 0)
This output used as an input string for another statement fails with the following parser error:
net.sf.jsqlparser.parser.ParseException: Encountered " "(" "( "" at line 1, column xxx.
Was expecting:
"SELECT" ...
Similar INSERT works fine.
One should expect that "toString" output of any statement should be not only functionally identical to the original query text, but can be also used to create another statement with the same result.
For replace statements it works only for simple queries. If query contains sub select it fails
Example:
Original query:
replace a_table (ID,A,B) select A_ID,A,B from b_table
Statement's toString output:
REPLACE a_table (ID, A, B) (SELECT A_ID, A, B FROM b_table WHERE D = 0)
This output used as an input string for another statement fails with the following parser error:
net.sf.jsqlparser.parser.ParseException: Encountered " "(" "( "" at line 1, column xxx.
Was expecting:
"SELECT" ...
Similar INSERT works fine.