Hi,

if i have a table and a rule like this

CREATE TABLE user (id SERIAL, name text);

CREATE RULE startaccount AS ON INSERT
    TO user
    DO INSERT INTO account (name) VALUES
    (new.id, new.name);

(i didnt check the syntax, hope you still get the point)

i get problems because it seems to me that new.id is not defined at the 
moment i do the insert. the default value seems not to be calculated at this 
time.

How can i get around this?

im quite new to sql and mabye there is a misunderstanding of the rule feature.

please give me a hint.
thanks in advance for any help.

janning

does anybody know a good book/website like an SQL cookbook with many many 
examples to learn from?


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to