in reply to Re: how to get complete information about tables
in thread how to get complete information about tables

Your line
$type_name = %{$dbh->type_info(%{$item}->{TYPE})}->{TYPE_NAME}
almost worked fine...

I get

Can't use an undefined value as a HASH reference at that line
when gets DATE or TIME data types.

On the other hand, I get type=text when expecting type=varchar

What am I missing here?

--------UPDATE----------------

Actually, it was with NUMERIC data types, not DATE nor TIME.
For these, I get TYPE=bytea, instead DATE or TIME.

But, if I change the line to

$type_name = %{$dbh->type_info(%{$item}->{TYPE})}->{SQL_DATETIME_SUB};
or
$type_name = %{$dbh->type_info(%{$item}->{TYPE})}->{SQL_DATA_TYPE};
I get NULL values.

From the DBD::Pg documentation, I read "Information is only provided for SQL datatypes and for frequently used datatypes."
Question: are DATE and TIME so infrequently used datatypes like that?

Isn't there any better way to get all information about DB tables?

Replies are listed 'Best First'.
Re^3: how to get complete information about tables
by insaniac (Friar) on Dec 08, 2004 at 08:12 UTC
    i'm sorry.. i don't know, i just used the example of type_info doc in order to retrieve the typenames. But if they are correct or not, I don't know. This is just what type_info outputs...
    and i won't be able to search for an answer today.. since i'm teaching all day long... tonight I can search for an answer, but maybe another monk (i'm just a mere scribe) knows the answer..
    --
    to ask a question is a moment of shame
    to remain ignorant is a lifelong shame