AW: [HACKERS] rules bug?
Zeugswetter Andreas <andreas.zeugswetter@telecom.at>
From: Zeugswetter Andreas IZ5 <Andreas.Zeugswetter@telecom.at>
To: hackers@postgreSQL.org
Cc: "'brook@trillium.NMSU.Edu'" <brook@trillium.NMSU.Edu>
Date: 1999-04-28T08:04:00Z
Lists: pgsql-hackers
> create rule surveys_ins as on insert to surveys > do instead > insert into survey_data (survey_date, name) > select new.survey_date, new.name where not exists > (select * from survey_data d where d.survey_date = new.survey_date > and d.name = new.name); > Since this is a rewrite rule, the whole statement gets rewritten, thus leading to different results, when one statement inserts many rows (insert into ... select) or one statement only inserts one row (insert ...). The "problem" is visibility of data. The rows that have already been inserted by this same statement (insert ...select) are not visible to the restricting select. Andreas