Jeff, GB, AnyBody
Checking the Pg.pm (V1.12) file for a type called numeric, I believe I
did not find one. INT2, INT4, INT8, FLOAT4, FLOAT8 and their local
translations int rel float etc. are there however. Armed with this info I
modified foo(bar int4) and another table to see how a table with a float
data type would behave, and the results were less distressing. Question: Is
the numeric type depreciated?
"Jeff Boes" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I've encountered a problem with the statement handle's pg_type
> attribute, under DBI 1.21 and DBD::Pg 1.12.
>
> Assuming a table that looks like this:
>
> CREATE TABLE foo ( bar numeric(2,1) );
>
>
> My script looks like this:
>
> use strict;
> use English;
>
> use DBI;
>
> my $dbh = DBI->connect('dbi:Pg:dbname=...','...','...')
> or die $DBI::errstr;
>
> my $sth = $dbh->prepare('SELECT * FROM foo WHERE FALSE')
> or die $DBI::errstr;
>
> $sth->execute
> or die $DBI::errstr;
>
> my @types = @{ $sth->{pg_type} };
> foreach my $i (0..$sth->{NUM_OF_FIELDS}-1) {
> print $types[$i], "\n";
> print $sth->{pg_type}[$i], "\n";
> }
>
> If you run this, you'll get some unprintable output from the first print
> statement, and the second print causes a segmentation fault.
>
> --
> Jeff Boes vox 616.226.9550 ext 24
> Database Engineer fax 616.349.9076
> Nexcerpt, Inc. http://www.nexcerpt.com
> ...Nexcerpt... Extend your Expertise
>