Re: How to check for successfull inserts

Поиск
Список
Период
Сортировка
От Arguile
Тема Re: How to check for successfull inserts
Дата
Msg-id LLENKEMIODLDJNHBEFBOMEIPEFAA.arguile@lucentstudios.com
обсуждение исходный текст
Ответ на How to check for successfull inserts  (Francisco Reyes <lists@natserv.com>)
Ответы Re: How to check for successfull inserts  ("Arguile" <arguile@lucentstudios.com>)
Re: How to check for successfull inserts  (Francisco Reyes <lists@natserv.com>)
Список pgsql-general
Francisco Reyes writes:
>
> I have a script of the form
> begin work
> delete
> copy from ...
> commit work
>
> Basically in a couple of ocassions the file been read from the copy
> command was empty. How could I check for this from a pgsql script?
>
> I tried look at PL-SQL manuals, but didn't find anything which would seem
> to help in solving this problem.
>

Normally I'd point you to this,

http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/plpgsql-statemen
ts.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

but I just checked and COPY FROM doesn't return that count (unlike INSERT).
It would be nice if it did but that doesn't help you much.

The only other thing I can think of off the top of my head is to count(*)
the table in question before and after and return the difference. As you're
within a transaction it will be accurate, if rather unwieldy.



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

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: decimal(5) vs int8. Which more efficient.
Следующее
От: "Arguile"
Дата:
Сообщение: Re: How to check for successfull inserts