[postgis-users] How to info like \d command in Perl

Puthick Hok hputhick at gmail.com
Thu Mar 3 20:23:54 PST 2011


Hi,

I am trying to find a way to retrieve the geography type of a Postgis
column in Perl.

Using these statements:

my $datatype   = $sth->{'TYPE'}->[$i];
my @type_info  = $dbh->type_info([$datatype]);
my $dtype_name = $type_info[0]->{'TYPE_NAME'};

The content of $dtype_name is 'unknown' which is not surprising.

In psql client, executing \d command gives me something like:

\d contactloc
              Table "public.contactloc"
     Column      |         Type          | Modifiers
-----------------+-----------------------+-----------
 contactid       | integer               | not null
 contactlocation | geography(Point,4326) | not null
Indexes:
    "contactloc_pkey" PRIMARY KEY, btree (contactid)
    "contactlocation_sp_index" gist (contactlocation)

Is there any way to check whether a geography column a point or a polygon?

Regards,
Puthick



More information about the postgis-users mailing list