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

Paragon Corporation lr at pcorp.us
Thu Mar 3 21:29:49 PST 2011


Yes, query the geography_columns view (type column)  for the said schema,
table, column.  You can also take a look and see how the view is built.

It is built against the postgresql catalog tables so will always reflect the
data type of the geography column.


Leo
http://www.postgis.us



 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Puthick
Hok
Sent: Thursday, March 03, 2011 11:24 PM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] How to info like \d command in Perl

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
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list