It would have been helpful if you posted the schema for the table,
but from what you wrote, I'll assume you have a table that's defined
something like:
create table tbl_name (
product_id int,
model_number int,
description char[]
);
If your description is really a "character array", may I suggest that
you change it to type "text" instead.
Your new table would look like:
create table new_tbl_name (
product_id int,
model_number int,
description text
);
Your array problems should go away, since you're not even dealing
with an array anymore.
Just for your information, if you want to put data into a column
that is an array of another type, you have to use the { }
notation. It's kind of like the [ ] array constructor in
perl.
Here's an example:
(Assume we're using the tbl_name table);
my $text = join('', <STDIN>);
my $pg_array =
join ('',
map { "'$_', " }
split ('', $text));
$pg_array =~ s/, $//;
$pg_array = "{ $pg_array }";
$dbh->do("
insert into tbl_name (product_id, model_number, description)
values ($prod_id, $mod_num, $pg_array)
");
Really, though -- don't use character arrays for text. Just use a text field.
|