postgresql - PL/pgQSL - enumerating over ROWTYPE in stored procedure -


After loading data from a CSV in an existing postgraz table, I will have a duplicate record that requires a merge. To do this, I plan to use a stored procedure that does the following:

  current_record airports% ROWTPE; New_record airports from Airports to% current_record from SELECT * to IKo LOOP SELECT * (STRICT) at new_record at airports where iko = current_record.iko and oid & lt; Current_record.oid - Is it possible to calculate on each such field? For Int i = 0; I & lt; New_record.fields.count; I ++ loop if new_record.field [i] not tap current_record.field [i] = new_record.field [i] end loop; End loop;   

Can I use the fields for internal loop as shown above, or do I have to decode my change logic for each field in the table? There are about 70 columns in it.

How to do this, other better ways besides this will also help.

TIA

There is no direct support for this. However you can ask the system catalog from within your function. But this will not do things fast.

Here's an example of how to trigger this triggers in the right direction.



Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -