Re: COPY is not working

Поиск
Список
Период
Сортировка
От Takahiro Itagaki
Тема Re: COPY is not working
Дата
Msg-id 20100430151307.94E0.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: COPY is not working  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Ответы Re: COPY is not working
Список pgsql-hackers
Jaime Casanova <jcasanov@systemguards.com.ec> wrote:

> ah! this is because COPY doesn't follow inherited tables... should it?

Yes. You can use "COPY (SELECT * FROM a) TO " instead to copy all tuples.

http://developer.postgresql.org/pgdocs/postgres/sql-copy.html
| COPY can only be used with plain tables, not with views.
| However, you can write COPY (SELECT * FROM viewname) TO .... 

Should we add "or parent tables" after "not with views"?
To be exact, it would be "'COPY a parent table TO' only copies
tuples in the parent table and does not copy inherited child tables".


regression=# CREATE TABLE a (aa integer);
CREATE TABLE
regression=# CREATE TABLE b () INHERITS (a);
CREATE TABLE
regression=# INSERT INTO b VALUES(32), (56);
INSERT 0 2
regression=# select * from a;aa
----3256
(2 rows)

regression=# COPY a TO '/tmp/copy_test';
COPY 0
regression=# COPY (SELECT * FROM a) TO '/tmp/copy_test';
COPY 2

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center




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

Предыдущее
От: Jaime Casanova
Дата:
Сообщение: Re: COPY is not working
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: COPY is not working