Re: Problem with COPY
От
Christian Rengstl
Тема
Re: Problem with COPY
Дата
Msg-id
44B36E35.0AD0.0080.0@klinik.uni-regensburg.de
Ответ на
Re: Problem with COPY (A. Kretschmer)
Список
Дерево обсуждения
Problem with COPY "Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>
Re: Problem with COPY "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Problem with COPY "Christian Rengstl" <Christian.Rengstl@klinik.uni-regensburg.de>
Re: Problem with COPY "A. Kretschmer" <andreas.kretschmer@schollglas.com>
Re: Problem with COPY "Leif B. Kristensen" <leif@solumslekt.org>
Re: Problem with COPY Alvaro Herrera <alvherre@commandprompt.com>
Re: Problem with COPY "Leif B. Kristensen" <leif@solumslekt.org>
Hi again everyone, i got it to work, but came across another question concerning COPY. If i have a column in a text file that i do not want/need in the database, is there a way not to read that column from the file without having to edit the file beforehand? Thanks for your advice! "A. Kretschmer" wrote on 07/10/06 11:28 am: > am 10.07.2006, um 10:21:59 +0200 mailte Christian Rengstl folgendes: >> Hi everyone, >> >> I have a table with a surrogate key which is an integer sequence. Is >> there a way to load a file using COPY and tell postgresql not to >> insert into the primary key column? > > Yes: > > test=# create table foobar (id serial primary key, name text); > NOTICE: CREATE TABLE will create implicit sequence "foobar_id_seq" for > serial column "foobar.id" > NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index > "foobar_pkey" for table "foobar" > CREATE TABLE > test=*# copy foobar (name) from stdin; > Enter data to be copied followed by a newline. > End with a backslash and a period on a line by itself. >>> name1 >>> name2 >>> name3 >>> \. > test=*# select * from foobar; > id | name > ----+------- > 1 | name1 > 2 | name2 > 3 | name3 > (3 rows) > > > HTH, Andreas > -- > Andreas Kretschmer (Kontakt: siehe Header) > Heynitz: 035242/47215, D1: 0160/7141639 > GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net > === Schollglas Unternehmensgruppe === > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly -- Christian Rengstl M.A. Klinik und Poliklinik für Innere Medizin II Kardiologie - Forschung Universitätsklinikum Regensburg B3 1.388 Franz-Josef-Strauss-Allee 11 93053 Regensburg Tel.: +49-941-944-7230
В списке pgsql-general по дате отправления
От: Harald Armin Massa
Дата: