Re: COPY example for partial tables

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: COPY example for partial tables
Дата
Msg-id 200510121455.j9CEtHt10423@candle.pha.pa.us
обсуждение исходный текст
Ответ на COPY example for partial tables  (David Fetter <david@fetter.org>)
Ответы Re: COPY example for partial tables  (Neil Conway <neilc@samurai.com>)
Список pgsql-docs
David Fetter wrote:
> Folks,
>
> Please find enclosed a patch (should work for 7.3 and up) that
> illustrates a workaround for using COPY on parts of tables using
> temporary tables.  It's helped me, and it seems popular via a very
> brief and un-scientific poll.

I have attached and applied a modified version of this patch.  I removed
the VACUUM (because this is just an example and does not need to be a
complete solution, e.g. pg_class bloat), and removed the 8.2 mention
because it seemed unnecessary.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: doc/src/sgml/ref/copy.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/ref/copy.sgml,v
retrieving revision 1.67
diff -c -c -r1.67 copy.sgml
*** doc/src/sgml/ref/copy.sgml    5 Sep 2005 14:44:05 -0000    1.67
--- doc/src/sgml/ref/copy.sgml    12 Oct 2005 14:53:17 -0000
***************
*** 709,714 ****
--- 709,727 ----
    </para>

    <para>
+    To copy into a file just the countries whose names start with 'A'
+    using a temporary table which is automatically deleted:
+   </para>
+ <programlisting>
+ BEGIN;
+ CREATE TEMP TABLE a_list_COUNTRIES AS
+     SELECT * FROM country WHERE country_name LIKE 'A%';
+ COPY a_list_countries TO '/usr1/proj/bray/sql/a_list_countries.copy';
+ ROLLBACK;
+ </programlisting>
+   </para>
+
+   <para>
     Here is a sample of data suitable for copying into a table from
     <literal>STDIN</literal>:
  <programlisting>

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Commented, loadable databases as examples?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [SQL] Update timestamp on update