Re: Is it necessary to have index for child table in following case?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Is it necessary to have index for child table in following case?
Дата
Msg-id 4B6A4323.4060607@joeconway.com
обсуждение исходный текст
Ответ на Re: Is it necessary to have index for child table in following case?  (Yan Cheng Cheok <yccheok@yahoo.com>)
Список pgsql-general
On 02/03/2010 06:59 PM, Yan Cheng Cheok wrote:
> PQexec(Database::instance().getConnection(), "copy unit_1 from
> stdin"); // | serial | int | int /* But I just do not want to put
> 9999 as serial. I want it to be auto-increment. However, I have no
> idea how to make serial auto-increment, without using INSERT. */
> PQputline(Database::instance().getConnection(),"9999\t1\t888\n");
> PQputline(Database::instance().getConnection(),"\\.\n");
> PQendcopy(Database::instance().getConnection());

You really need to get up close and personal with the fine manual.

See:
-----------
http://developer.postgresql.org/pgdocs/postgres/sql-copy.html

Specifically:
-----------
Synopsis

COPY table_name [ ( column [, ...] ) ]
    FROM { 'filename' | STDIN }
    [ [ WITH ] ( option [, ...] ) ]

Example:
-----------
regression=# create table foo(f1 serial, f2 text);
NOTICE:  CREATE TABLE will create implicit sequence "foo_f1_seq" for
serial column "foo.f1"
CREATE TABLE
regression=# copy foo (f2) from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> hello
>> world
>> \.

regression=# select * from foo;
 f1 |  f2
----+-------
  1 | hello
  2 | world
(2 rows)

HTH,

Joe



Вложения

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

Предыдущее
От: Yan Cheng Cheok
Дата:
Сообщение: Re: Is it necessary to have index for child table in following case?
Следующее
От: Sim Zacks
Дата:
Сообщение: Re: Shall I apply normalization in the following case?