Thread: 2 Aktions in a Rule
Hello, I hope someone can help me. I Want 2 Aktions executeed in a Rule like: CREATE RULE auftraege_neu_delete AS ON delete TO auftraege_neu DO (DELETE FROM auftraege_neu_positionen WHEREauftraege_neu_positionen.auftragsnr = OLD.auftragsnr;DELETE FROM auftraege_neu_zubehoer WHERE auftraege_neu_zubehoer.auftragsnr = OLD.auftragsnr;); but I get a Parser Error: ERROR: parser: parse error at or near "" This is in PostgreSQL 6.5.2 Has anyone the correct syntax? regards Florian
I have the same problem. Dox says that multiple actions are permitted on a single rule. But it won't work. I do not know why. On 05-Oct-99 Florian Makesch wrote: > Hello, > I hope someone can help me. I Want 2 Aktions executeed in a Rule like: > CREATE RULE auftraege_neu_delete AS ON delete > TO auftraege_neu DO > (DELETE FROM auftraege_neu_positionen > WHERE auftraege_neu_positionen.auftragsnr = OLD.auftragsnr; > DELETE FROM auftraege_neu_zubehoer > WHERE auftraege_neu_zubehoer.auftragsnr = OLD.auftragsnr;); > but I get a Parser Error: > ERROR: parser: parse error at or near "" > This is in PostgreSQL 6.5.2 > > Has anyone the correct syntax? > > regards > Florian > > > ************ Sergey Bondarenko Relcom-Ukraine system administrator
Florian Makesch <F.Makesch@sbe-zeta.de> writes: > I hope someone can help me. I Want 2 Aktions executeed in a Rule like: > CREATE RULE auftraege_neu_delete AS ON delete > TO auftraege_neu DO > (DELETE FROM auftraege_neu_positionen > WHERE auftraege_neu_positionen.auftragsnr = OLD.auftragsnr; > DELETE FROM auftraege_neu_zubehoer > WHERE auftraege_neu_zubehoer.auftragsnr = OLD.auftragsnr;); > but I get a Parser Error: > ERROR: parser: parse error at or near "" > This is in PostgreSQL 6.5.2 > Has anyone the correct syntax? There's nothing wrong with that syntax AFAICS. Furthermore, my copy of Postgres takes it just fine (both 6.5.2 and current sources). I suspect you compiled with a buggy version of yacc or bison. Postgres' grammar is large and complex enough that it tends to expose problems in vendor-supplied yaccs :-(. Try getting a recent GNU bison (let's see ... I have 1.25 installed here, it's probably not the latest) and rebuilding. regards, tom lane
Yep. It works. I had the problem with 6.5.1 version both on RedHat 5.1 and FreeBSD 3.2 boxes. It runs just fine, when is built using bison-1.28 (available at ftp.gnu.org). Thanks all. On 05-Oct-99 Tom Lane wrote: > Florian Makesch <F.Makesch@sbe-zeta.de> writes: >> I hope someone can help me. I Want 2 Aktions executeed in a Rule like: >> CREATE RULE auftraege_neu_delete AS ON delete >> TO auftraege_neu DO >> (DELETE FROM auftraege_neu_positionen >> WHERE auftraege_neu_positionen.auftragsnr = OLD.auftragsnr; >> DELETE FROM auftraege_neu_zubehoer >> WHERE auftraege_neu_zubehoer.auftragsnr = OLD.auftragsnr;); >> but I get a Parser Error: >> ERROR: parser: parse error at or near "" >> This is in PostgreSQL 6.5.2 >> Has anyone the correct syntax? > > There's nothing wrong with that syntax AFAICS. Furthermore, my copy > of Postgres takes it just fine (both 6.5.2 and current sources). > > I suspect you compiled with a buggy version of yacc or bison. Postgres' > grammar is large and complex enough that it tends to expose problems > in vendor-supplied yaccs :-(. Try getting a recent GNU bison (let's > see ... I have 1.25 installed here, it's probably not the latest) > and rebuilding. > > regards, tom lane > > ************ Sergey Bondarenko Relcom-Ukraine system administrator