From d02bf0a6614d5f8bdbd0322f1331c8be02f0abc2 Mon Sep 17 00:00:00 2001 From: dim Date: Tue, 12 Feb 2008 17:03:26 +0000 Subject: [PATCH] Update documentation to show how to have PostgreSQL generate columns list --- pgloader.1.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pgloader.1.txt b/pgloader.1.txt index 0ed769d..730c7cd 100644 --- a/pgloader.1.txt +++ b/pgloader.1.txt @@ -440,6 +440,25 @@ In case you have a lot a columns per table, you will want to use multiple lines for this parameter value. Python ConfigParser module knows how to read multi-line parameters, you don't have to escape anything. ++ +An easy way to get the list of attributes (columns) of your tables +(say +a+, +b+ and +c+) is by the following query: ++ + BEGIN; + CREATE AGGREGATE array_acc(anyelement) ( + SFUNC = array_append, + STYPE = anyarray, + INITCOND = '{}' + ); + + SELECT relname, array_acc(attname) + FROM pg_attribute a join pg_class c on a.attrelid = c.oid + WHERE relname in ('a', 'b', 'c') + and attname not in ('tableoid','cmax','xmax','cmin','xmin','ctid') + GROUP BY relname; + + ROLLBACK; ++ user_defined_columns:: +