semicolons separating statements in a rule action body confuses parseQuery()

Поиск
Список
Период
Сортировка
Искать

semicolons separating statements in a rule action body confuses parseQuery()

От:
Jolly Chen <jolly@gauntletsystems.com>
Дата:
using jdbc-8.0-313 against 8.0.4,

the driver gets confused when parsing rule definition statements with  
embedded semicolons such as :

"create rule r1 as on insert to foo do (delete from bar; insert into  
bar select * from foo; );  "

the following patch shows a possible quick fix for  
QueryExecutorImpl.parseQuery() in org/postgresql/core/v3/ 
QueryExecutorImpl.java

69d68
<       int inParen = 0;
77,82d75
<             case '(':
<               if (!inSingleQuotes && !inDoubleQuotes) inParen++;
<               break;
<             case ')':
<               if (!inSingleQuotes && !inDoubleQuotes) inParen--;
<               break;
105c98
<                 if (!inSingleQuotes && !inDoubleQuotes && inParen  
== 0)
---
 >                 if (!inSingleQuotes && !inDoubleQuotes) 
            

Re: semicolons separating statements in a rule action body

От:
Kris Jurka <books@ejurka.com>
Дата:


On Wed, 2 Nov 2005, Jolly Chen wrote:

> using jdbc-8.0-313 against 8.0.4,
>
> the driver gets confused when parsing rule definition statements with 
> embedded semicolons such as :
>
> "create rule r1 as on insert to foo do (delete from bar; insert into bar 
> select * from foo; );  "
>
> the following patch shows a possible quick fix for

Patch applied to 8.0 and head cvs branches.  For future reference we 
prefer context diffs (diff -c) patches.

Kris Jurka
FAQ