Re: [GENERAL] Rules and conditions

2009-12-09 Thread Guillaume Lelarge
Le mercredi 9 décembre 2009 à 12:38:33, George Silva a écrit : > Hello guys, > > Still having some trouble with this. > > I'm trying to use a case when, but postgres is still giving me syntax > error. > > CREATE OR REPLACE RULE instead_update AS ON UPDATE TO foo > DO INSTEAD > ( > CASE SELECT e

Re: [GENERAL] Rules and conditions

2009-12-09 Thread George Silva
Hello guys, Still having some trouble with this. I'm trying to use a case when, but postgres is still giving me syntax error. CREATE OR REPLACE RULE instead_update AS ON UPDATE TO foo DO INSTEAD ( CASE SELECT exists(SELECT 1 FROM versioning.foo_version_1 WHERE OLD.oid = NEW.oid) as a WHEN a=true

Re: [GENERAL] Rules and conditions

2009-12-09 Thread Leif Biberg Kristensen
On Wednesday 9. December 2009 09.06.12 Guillaume Lelarge wrote: > Le mercredi 9 décembre 2009 à 01:52:03, George Silva a écrit : > > [...] > > I can't seem to understand why a simples if is not working on the > > creation of rules. > > > > I tried both ways (am i missing something?): > > > > Sur

Re: [GENERAL] Rules and conditions

2009-12-09 Thread Guillaume Lelarge
Le mercredi 9 décembre 2009 à 01:52:03, George Silva a écrit : > [...] > I can't seem to understand why a simples if is not working on the > creation of rules. > > I tried both ways (am i missing something?): > Sure. IF does not exist in SQL, and you can only put SQL statements in a rule. Inste

[GENERAL] Rules and conditions

2009-12-08 Thread George Silva
Hello guys, I can't seem to understand why a simples if is not working on the creation of rules. I tried both ways (am i missing something?): Take a look: CREATE OR REPLACE RULE instead_update AS ON UPDATE TO foo DO INSTEAD ( IF exists(SELECT 1 FROM versioning.foo_version_1 WHERE oid =