More Trigger Fun

Another scenario that will not work in a multiuser environment. Seems like a case for an on-commit fast refresh materialized view defined as …

Select COUNT (*) num_rows
FROM mytable
Where relationship = ‘friend’
having count(*) > 2;

Place a check constraint on num_rows to say 1=0 and there you go … multiuser compatibility for a multirow constraint.


4 thoughts on “More Trigger Fun

  1. It’s a technique that might catch on!

    Actually I posted on a similar issue a few days ago, and then earlier today when the same sort of question cropped up … eventually I just couldn’t stand the stress of no-one pointing out that triggers like that don’t work in multiuser environments, so I linked back to the blog.

    Come to think of it, it’s kind of like answering questions on a blog just so you can link to books that your consultancy has published … so obviously there’s nothing unethical about it! Just for a laugh search here for posts that include the text “rampant-books”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s