Reputation: 16341
What's with this?
my $sth = $dbh->prepare(q~
select 'hello'::text as my_text_column
~);
$sth->execute;
print $$sth{TYPE}[0]; # prints -1, expected 12
I can select 5
and it returns the correct type (4
, for integer) or cast it like select 5::numeric(4, 2)
and get back 3
. Why doesn't it like text columns?
Upvotes: 1
Views: 652
Reputation: 7018
I don't know the answer to your question, but as a workaround, you could use the postgres-specific $sth->{pg_type}
rather than $sth->{TYPE}
.
In your example, $sth->{pg_type}->[0]
would return 'text'.
Upvotes: 2