You were correct below trigger worked. Giving reference for others.
CREATE OR REPLACE FUNCTION init() RETURNS TEXT AS $$
my $raw_row = "(\"col1\", \"col2\")";
my @new_row = ('5', '6');
my @col_types = ("integer", "character varying");
my $query = "INSERT INTO mytable $
Tom Lane escribió:
> I'm not much of a Perl hacker, but I seem to recall that it's possible
> to pass an array to a function in a way that will make the array
> elements look like separate arguments. If you really need a dynamic
> list of types and values, maybe there's some solution in that dire
paresh masani writes:
> Below function doesn't work: (I tried each combination mentioned with
> # but none of them working.)
I haven't tried it, but a look at the code makes me think that
spi_prepare wants each type name to appear as a separate argument.
It definitely won't work to smash them all
Hi, I have been getting strange behaviors in using spi_prepare and
spi_exec_prepared. The below function works fine (every thing is hard
coded):
CREATE OR REPLACE FUNCTION init() RETURNS TEXT AS $$
my $prepared = spi_prepare("INSERT INTO mytable (\"col1\", \"col2\")
VALUES (\$1, \$2)", "i