in reply to DBD::Pg insert data into an array

This is how to do that in a more effective way, using prepare_cached().
my @data = ( ["A description", ["string 1", "string 2"], [ 1, 2, 3]], ["B description", ["string 3", "string 4"], [ 4, 5, 6]], ["C description", ["string 5", "string 6"], [ 7, 8, 9]], ["D description", ["string 7", "string 8"], [10,11,12]], ); my $sth = $dbh->prepare_cached("insert into my_table(description, asso +ciated_str_data, associated_int_data) values (?, ?, ?)"); $sth->execute(@$_) for @data; $dbh->commit;

Replies are listed 'Best First'.
Re^2: DBD::Pg insert data into an array
by rdfield (Priest) on Dec 19, 2018 at 21:00 UTC
    In a batch environment, yes, your way might be more effective - but in a batch environment I'd question the wisdom of burying data inside an array column.

    rdfield