Hi community,
I would like to retrieve all the fieldnames of a given table. In the
perl module Tie::DBI[1] i found the following fragment:
$dbh-prepare(LISTFIELDS $table);
in the case the DB supports this (Tie::DBI thinks so for Pg) or the
alternative is:
$dbh-prepare(SELECT * FROM
One way to do this is to use the column_info database handle method.
Here's a little perl script that accepts a table name as an argument
and returns the column names:
#!/usr/bin/perl
use DBI;
use strict;
my( $database, $table ) = @ARGV;
my $dbh = DBI-connect( dbi:Pg:dbname=$database, 'postgres'