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 Hackers > Re: minimal upd...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 39 Topic 9324 of 10966
Post > Topic >>

Re: minimal update

by andrew@[EMAIL PROTECTED] (Andrew Dunstan) May 7, 2008 at 09:25 PM

Right. In fact, I already had that part in fact - see 
http://people.planetpostgresql.org/andrew/index.php?/archives/22-Minimal-Update-Trigger.html

What I was waiting for was the part where it gets put in the catalog, 
do***ented, etc.

cheers

andrew

Bruce Momjian wrote:
> Andrew Dunstan wrote:
>   
>> Not that I know of.  I never saw Gurjeet's completed code.
>>     
>
> This is Gurjeet's code, but it is not complete.
>
> 	http://archives.postgresql.org/pgsql-hackers/2008-03/msg00668.php
>
>
---------------------------------------------------------------------------
>
>   
>> cheers
>>
>> andrew
>>
>> Bruce Momjian wrote:
>>     
>>> Is there a version of this patch ready for application?
>>>
>>>
---------------------------------------------------------------------------
>>>
>>> Gurjeet Singh wrote:
>>>   
>>>       
>>>> On Tue, Mar 18, 2008 at 7:46 PM, Andrew Dunstan <andrew@[EMAIL PROTECTED]
>
wrote:
>>>>
>>>>     
>>>>         
>>>>>
>>>>> Gurjeet Singh wrote:
>>>>>       
>>>>>           
>>>>>> On Fri, Mar 7, 2008 at 9:40 PM, Bruce Momjian <bruce@[EMAIL PROTECTED]
>>>>>> <mailto:bruce@[EMAIL PROTECTED]
>> wrote:
>>>>>>
>>>>>>
>>>>>>     I assume don't want a TODO for this?  (Suppress UPDATE no
changed
>>>>>>     columns)
>>>>>>
>>>>>>
>>>>>> I am starting to implement this. Do we want to have this trigger
>>>>>> function in the server, or in an external module?
>>>>>>
>>>>>>
>>>>>>         
>>>>>>             
>>>>> I have the trigger part of this done, in fact. What remains to be
done
>>>>> is to add it to the catalog and do***ent it. The intention is to
make it
>>>>> a builtin as it will be generally useful. If you want to work on the
>>>>> remaining parts then I will happily ****p you the C code for the
trigger.
>>>>>
>>>>>
>>>>>       
>>>>>           
>>>> In fact, I just finished writing the C code and including it in the
catalog
>>>> (Just tested that it's visible in the catalog). I will test it to see
if it
>>>> does actually do what we want it to.
>>>>
>>>> I have incor****ated all the suggestions above. Would love to see your
code
>>>> in the meantime.
>>>>
>>>> Here's the C code:
>>>>
>>>> Datum
>>>> trig_ignore_duplicate_updates( PG_FUNCTION_ARGS )
>>>> {
>>>>     TriggerData *trigData;
>>>>     HeapTuple oldTuple;
>>>>     HeapTuple newTuple;
>>>>
>>>>     if (!CALLED_AS_TRIGGER(fcinfo))
>>>>         elog(ERROR, "trig_ignore_duplicate_updates: not called by
trigger
>>>> manager.");
>>>>
>>>>     if( !TRIGGER_FIRED_BY_UPDATE(trigData->tg_event)
>>>>         && !TRIGGER_FIRED_BEFORE(trigData->tg_event)
>>>>         && !TRIGGER_FIRED_FOR_ROW(trigData->tg_event) )
>>>>     {
>>>>         elog(ERROR, "trig_ignore_duplicate_updates: Can only be
executed for
>>>> UPDATE, BEFORE and FOR EACH ROW.");
>>>>     }
>>>>
>>>>     trigData =  (TriggerData *) fcinfo->context;
>>>>     oldTuple = trigData->tg_trigtuple;
>>>>     newTuple = trigData->tg_newtuple;
>>>>
>>>>     if (newTuple->t_len == oldTuple->t_len
>>>>         && newTuple->t_data->t_hoff == oldTuple->t_data->t_hoff
>>>>         && HeapTupleHeaderGetNatts(newTuple->t_data) ==
>>>> HeapTupleHeaderGetNatts(oldTuple->t_data)
>>>>         && (newTuple->t_data->t_infomask & ~HEAP_XACT_MASK)
>>>>             == (oldTuple->t_data->t_infomask & ~HEAP_XACT_MASK)
>>>>         && memcmp( (char*)(newTuple->t_data) +
offsetof(HeapTupleHeaderData,
>>>> t_bits),
>>>>                 (char*)(oldTuple->t_data) +
offsetof(HeapTupleHeaderData,
>>>> t_bits),
>>>>                     newTuple->t_len - offsetof(HeapTupleHeaderData,
t_bits)
>>>> ) == 0 )
>>>>     {
>>>>         /* return without crating a new tuple */
>>>>         return PointerGetDatum( NULL );
>>>>     }
>>>>
>>>>     return PointerGetDatum( trigData->tg_newtuple );
>>>> }
>>>>
>>>>
>>>>
>>>> -- 
>>>> gurjeet[.singh]@[EMAIL PROTECTED]
>>>> singh.gurjeet@[EMAIL PROTECTED]
 gmail | hotmail | indiatimes | yahoo }.com
>>>>
>>>> EnterpriseDB http://www.enterprisedb.com
>>>>
>>>> 17? 29' 34.37"N, 78? 30' 59.76"E - Hyderabad *
>>>> 18? 32' 57.25"N, 73? 56' 25.42"E - Pune
>>>> 37? 47' 19.72"N, 122? 24' 1.69" W - San Francisco
>>>>
>>>> http://gurjeet.frihost.net
>>>>
>>>> Mail sent from my BlackLaptop device
>>>>     
>>>>         
>>>   
>>>       
>
>   

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 39 Posts in Topic:
Re: minimal update
bruce@[EMAIL PROTECTED]   2008-05-07 20:34:20 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-05-07 20:38:02 
Re: minimal update
bruce@[EMAIL PROTECTED]   2008-05-07 21:16:56 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-05-07 21:25:01 
Re: minimal update
bruce@[EMAIL PROTECTED]   2008-05-07 21:29:22 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-05-07 21:36:06 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-14 20:29:28 
Re: minimal update
bruce@[EMAIL PROTECTED]   2008-10-15 22:42:11 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-16 13:37:57 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-16 13:44:46 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-16 14:03:26 
Re: minimal update
magnus@[EMAIL PROTECTED]   2008-10-20 10:28:35 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-20 10:51:54 
Re: minimal update
magnus@[EMAIL PROTECTED]   2008-10-21 15:34:04 
Re: minimal update
david@[EMAIL PROTECTED]   2008-10-21 06:36:30 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-21 09:40:56 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-21 10:11:41 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-22 14:43:24 
Re: minimal update
mmoncure@[EMAIL PROTECTED  2008-10-21 09:39:09 
Re: minimal update
Kevin.Grittner@[EMAIL PRO  2008-10-22 13:56:53 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-22 15:15:54 
Re: minimal update
simon@[EMAIL PROTECTED]   2008-10-22 20:21:06 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-22 15:24:35 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-22 15:27:02 
Re: minimal update
robertmhaas@[EMAIL PROTEC  2008-10-22 17:24:30 
Re: minimal update
simon@[EMAIL PROTECTED]   2008-10-22 22:56:37 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-22 18:05:26 
Re: minimal update
ktm@[EMAIL PROTECTED] (K  2008-10-22 17:10:55 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-29 15:31:09 
Re: minimal update
magnus@[EMAIL PROTECTED]   2008-10-29 20:34:35 
Re: minimal update
alvherre@[EMAIL PROTECTED  2008-10-29 16:35:21 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-29 15:48:09 
Re: minimal update
david@[EMAIL PROTECTED]   2008-10-29 13:08:29 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-29 16:20:15 
Re: minimal update
andrew@[EMAIL PROTECTED]   2008-10-29 16:36:06 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-29 22:44:54 
Re: minimal update
tgl@[EMAIL PROTECTED] (T  2008-10-29 23:24:07 
Re: minimal update
Kevin.Grittner@[EMAIL PRO  2008-10-22 17:11:50 
Re: minimal update
robertmhaas@[EMAIL PROTEC  2008-10-22 18:57:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Mon Dec 1 14:07:01 CST 2008.