Andreas Fromm writes:Yes, but the advantage of the select would be that I could do a SELECT .. FROM .. WHERE , or how can I perform a checking of the data before insertion?
I was thinking of defining a view "users" over "persons" which would let me retrive the list of useres. But How would I implement the rule for insertiung users? I tryed the following but NEW is not known where I want to use it:
CREATE VIEW users AS SELECT * FROM persons WHERE is_user(person.id) = TRUE;
CREATE RULE insert_on_users AS ON INSERT
TO users DO INSTEAD
INSERT INTO persons SELECT * FROM NEW;
You can write
... DO INSTEAD INSERT INTO persons VALUES (NEW.col1, NEW.col2, ...);
Andreas
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
