Thread: usage of spi_prepare from PL/Perl

usage of spi_prepare from PL/Perl

From
paresh masani
Date:
Hi, I am new to PostgreSQL. I have started learning and written
triggers and they are working fine. Currently I am using spi_exe_query
to insert/update my log table when primary table updated. Could any
one please give me an example of spi_prepare and spi_execute_plan
usage in  PL/Perl that I can use in my trigger. I couldn't find any
example in documentation.

Basically, I want to prepare a plan and want to store it in %_SHARED
hash so that I can use whenever I want. Moreover, if table definition
changed then I should purge the cache.

any suggestion would be much appreciated.

Thanks,
Paresh