Re: COPY seems to work, but no data in the table

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: COPY seems to work, but no data in the table
Дата
Msg-id 10829.1026877812@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: COPY seems to work, but no data in the table  (Lee Harr <missive@frontiernet.net>)
Список pgsql-general
Lee Harr <missive@frontiernet.net> writes:
> oh. Here is is:
> http://archives.postgresql.org/pgsql-bugs/2002-02/msg00173.php

> What I found was that if a foreign key constraint was not satisfied
> while COPYing data in to a table, the whole COPY would fail, but
> there was never any error message.

> As I recall it, Tom Lane looked at this problem at the time and said
> that it would be less than simple to fix.

The example I cited in my followup works in CVS tip ... or at least
it reports a failure message:

regression=# create table foo(f1 int primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
CREATE TABLE
regression=# create table bar(f2 int references foo);
NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE TABLE
regression=# copy bar from stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> 1
>> \.
ERROR:  $1 referential integrity violation - key referenced from bar not found in foo
lost synchronization with server, resetting connection
regression=#

I believe it works the same way in 7.2.1, but don't have an
exactly-7.2.1-release code tree handy to check.  (This is a post-7.2
bug fix though, 7.2 will fail :-()

            regards, tom lane

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

Предыдущее
От: Steve Lane
Дата:
Сообщение: Logging SQL queries?
Следующее
От: Ben Liblit
Дата:
Сообщение: dropping anonymous constraints