Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Novice > Re: Triggers | ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 3024 of 3322
Post > Topic >>

Re: Triggers | rules for column updates

by andreas.kretschmer@[EMAIL PROTECTED] ("A. Kretschmer") Mar 3, 2008 at 03:16 PM

am  Mon, dem 03.03.2008, um 15:47:58 +0200 mailte Szentpali Janos
folgendes:
> Hi!
> 
> I want to prevent any changes to a tuple if a field of the tuple has a 
> certain value. Let's say I have a table with column col_1, col_2, col_3.

> I want to create something that will prevent updating col_2 and col_3 if

> and only if col_1 is say "1".
> Can I use a rule to do that. Can I somehow detect in a trigger function 

I think, a RULE isn't the solution, but you can use a BEFORE UPDATE -
Trigger to check if OLD.col_1 = 1 and, in this case, RAISE an error.



Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

--
Sent via pgsql-novice mailing list (pgsql-novice@[EMAIL PROTECTED]
)
To make changes to your Subscription:
http://mail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&extra=pgsql-novice
 




 2 Posts in Topic:
Triggers | rules for column updates
ianus@[EMAIL PROTECTED]   2008-03-03 15:47:58 
Re: Triggers | rules for column updates
andreas.kretschmer@[EMAIL  2008-03-03 15:16:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 4:02:45 CST 2008.