Re: Question on Rules - Mailing list pgsql-general
From | |
---|---|
Subject | Re: Question on Rules |
Date | |
Msg-id | 20120220100718.c760ddbd7c0975bc4b045766db7d895c.3e5fd92639.wbe@email16.secureserver.net Whole thread Raw |
In response to | Question on Rules (<mgould@isstrucksoftware.net>) |
Responses |
Re: Question on Rules
|
List | pgsql-general |
<table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" style="empty-cells: show;" width="100%"><tr><td;=";" </td="</td" align="left" background="cid:top@58571d753b9e554223bb4a1866f4c8b1" colspan="1" height="72"style="text-align: left; background-repeat: no-repeat;"></td></tr><tr><td style="vertical-align: top;"><div style="padding:5px; overflow-x: auto;"></div></td></tr></table><span style="font-family:Verdana; color:#000000; font-size:10pt;"><div>David,</div><div> </div><div>Arerules deprecated?<br /></div><div><br /></div><div>Michael Gould</div><div>IntermodalSoftware Solutions, LLC</div><div>904-226-0978</div><div> </div><div> </div><blockquote id="replyBlockquote"style="BORDER-LEFT: blue 2px solid; PADDING-LEFT: 8px; FONT-FAMILY: verdana; COLOR: black; MARGIN-LEFT:8px; FONT-SIZE: 10pt" webmail="1"><div id="wmQuoteWrapper">-------- Original Message --------<br />Subject: Re:[GENERAL] Question on Rules<br />From: "David Johnston" <<a href="mailto:polobo@yahoo.com">polobo@yahoo.com</a>><br/>Date: Sun, February 19, 2012 9:16 pm<br />To: <<a href="mailto:mgould@isstrucksoftware.net">mgould@isstrucksoftware.net</a>>,<<a href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org</a>><br/><br />-----Original Message-----<br />From:<a href="mailto:pgsql-general-owner@postgresql.org">pgsql-general-owner@postgresql.org</a> [<a href="mailto:pgsql-general-owner@postgresql.org">mailto:pgsql-general-owner@postgresql.org</a>]On Behalf Of <a href="mailto:mgould@isstrucksoftware.net">mgould@isstrucksoftware.net</a><br/>Sent: Saturday, February 18, 2012 5:17 AM<br/>To: <a href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org</a><br />Subject: [GENERAL] Questionon Rules<br /><br />I am creating a rule which will copy a record when it is changed to a audittable. My questionis that the first column is a UUID data type with a defined as auditaccessorid uuid DEFAULT<br />isscontrib.uuid_generate_v4()NOT NULL,<br /><br />Right now I've got that set to NULL to allow the parser to "compile".<br />What value should I have in here since I want a newly created UUID?<br /><br />CREATE RULE log_accessor ASON UPDATE TO iss.accessor<br />WHERE NEW.* <> OLD.*<br />DO INSERT INTO iss.auditaccessor VALUES (NULL,<br />'C',<br/>new.loaddtlid, <br />new.seqno, <br />new.billable,<br />new.payind,<br />new.code,<br />new.description, <br/>new.ref,<br />new.tractororcarrierflag, <br />new.tractororcarrierno,<br />new.tractorpct,<br />new.charge,<br />new.type,<br/>new.checkdate,<br />new.checkno,<br />new.processed,<br />new.itemflag, <br />new.tractortermloc,<br />new.cost,<br/>new.batchno,<br />new.editdatetime, <br />new.edituser);<br /><br />Best Regards,<br /><br />Michael Gould<br/>Intermodal Software Solutions, LLC<br />904-226-0978<br /><br /><br />--------------------------------------------------------------------<br/><br />INSERT INTO table (serial_col1) VALUES (DEFAULT);<br/><br />Also, I presume you have a good reason for using a RULE instead of a TRIGGER? If not you should defaultto a TRIGGER for this kind of behavior.<br /><br />David J.<br /><br /><br /><br />-- <br />Sent via pgsql-generalmailing list (<a href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org</a>)<br />To make changesto your subscription:<br /><a href="http://www.postgresql.org/mailpref/pgsql-general">http://www.postgresql.org/mailpref/pgsql-general</a><br /></div></blockquote></span>
pgsql-general by date: