Re: [GENERAL] 8.3 PL/pgSQL comparing arbitrary records

2009-12-15 Thread Josh Kupershmidt
On Tue, Dec 15, 2009 at 1:23 AM, Pavel Stehule wrote: > Hello > > NEW and OLD is comparable in 8.4. In 8.3 and older you have to use > little bit different syntax > > http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Fast_compare_variables_NEW_and_OLD_in_trigger.27s_body > Thanks, Pavel! Thi

Re: [GENERAL] 8.3 PL/pgSQL comparing arbitrary records

2009-12-14 Thread Alexander Pyhalov
Hello. It seems that this works (I made tests on permanent table, postgresql 8.4.0): CREATE OR REPLACE FUNCTION track_updates() RETURNS TRIGGER AS $$ DECLARE BEGIN IF TG_OP = 'UPDATE' THEN IF NEW IS NOT DISTINCT FROM OLD THEN RAISE NOTICE 'OLD and NEW are the same!';

Re: [GENERAL] 8.3 PL/pgSQL comparing arbitrary records

2009-12-14 Thread Pavel Stehule
Hello NEW and OLD is comparable in 8.4. In 8.3 and older you have to use little bit different syntax http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Fast_compare_variables_NEW_and_OLD_in_trigger.27s_body Regards Pavel Stehule 2009/12/15 Josh Kupershmidt : > Hi all, > > Short version of m

[GENERAL] 8.3 PL/pgSQL comparing arbitrary records

2009-12-14 Thread Josh Kupershmidt
Hi all, Short version of my question: What's the best way to compare arbitrary records (OLD and NEW, in my case) using PL/pgSQL in Postgres 8.3, without knowing anything about the structure of the records? If the answer is to cast OLD and NEW to text, and then compare, as suggested in [1], what fa