By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,738 Members | 1,301 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,738 IT Pros & Developers. It's quick & easy.

dumping fields from Perl

P: n/a
How can I dump the field names and their type and attributes from Perl?
Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
On Sun, 29 Feb 2004 13:11:48 -0600
Tony Rice <em***@email.com> wrote:
How can I dump the field names and their type and attributes from Perl?


use Pg;
use strict;
use warnings;

my $select=<<"SQL";

SELECT c.relname, a.attname, t.typname, a.attrelid
FROM pg_class c, pg_attribute a, pg_type t
WHERE c.relkind = 'r'
AND a.attnum > 0
AND a.attrelid = c.oid and a.atttypid = t.oid
ORDER BY relname, attname

SQL

# Do connection here...
my $PG=new Pg::connectdb(".....");
my $res=$PG->exec($select);

etc.

Hope that helps. I may have typoed above, and it is untested, but it's something
to work with.

Ciao

Zak

--
================================================== ======================
http://www.carfolio.com/ Searchable database of 10 000+ car specs
================================================== ======================

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.