Re: dumping fields from Perl

Поиск
Список
Период
Сортировка
От Zak McGregor
Тема Re: dumping fields from Perl
Дата
Msg-id 20040301011706.12d5ad23.zak@mighty.co.za
обсуждение исходный текст
Ответ на dumping fields from Perl  (Tony Rice <email@email.com>)
Список pgsql-general
On Sun, 29 Feb 2004 13:11:48 -0600
Tony Rice <email@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
========================================================================

В списке pgsql-general по дате отправления:

Предыдущее
От: elein
Дата:
Сообщение: Re: SERIAL type - auto-increment grouped by other field
Следующее
От: Zak McGregor
Дата:
Сообщение: count(1) return 0?