> > Soma> All values called from the database are still padded with
> > Soma> extra spaces from the column size in the database. Is this
> > Soma> normal - I don't remember this happening when I was using
> > Soma> MySQL. I thought usually the database stripped the extra
> > Soma> spaces when it retrieved the values.
>
> According to "Postgres: Introduction and Concepts", varchar is slower
> than char. So if you (like me) want to use char and get rid of the
> padding spaces, you may use a regex replacement, as in
>
> while (@row=$result->fetchrow)
> {
> $row[0] =~ s/[\s]+$//;
> }
>
> in perl, or
>
> $array["name"]=preg_replace("'[\s]+$'", "", $array["name"], -1);
>
> in PHP.
>
I'm new to the list so I'm not sure if this has already been said, but Perl
DBI has an option to trim trailing spaces in the connect statement. eg:
my $dbh = DBI->connect("dbi:Pg:dbname=mydb",
'myuser','mypass',
{RaiseError => 1, AutoCommit => 0, ChopBlanks => 1})
or die $DBI::errstr;
Cheers