From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | ToDo: allow to get a number of processed rows by COPY statement |
Date: | 2011-10-04 10:22:19 |
Message-ID: | CAFj8pRAeEUSP8zuNkNcMP1gkr_i9KVN76S+A+13ehj=Z8E5Wow@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello
There is not possible to get a number of processed rows when COPY is
evaluated via SPI. Client can use a tag, but SPI doesn't use a tag.
I propose a small change a ProcessUtility to return a processed rows.
Note: I found a small inconsistency between SPI and Utility interface.
SPI still use a 4 byte unsign int for storing a number of processed
rows. Utility use a 8bytes unsign int.
Motivation:
postgres=# \sf fx
CREATE OR REPLACE FUNCTION public.fx(tablename text, filename text)
RETURNS integer
LANGUAGE plpgsql
AS $function$
declare r int;
begin
execute format('COPY %s FROM %s', quote_ident(tablename),
quote_literal(filename));
get diagnostics r = row_count;
return r;
end;
$function$
Regards
Pavel Stehule
Attachment | Content-Type | Size |
---|---|---|
copy_processed_rows.diff | text/x-patch | 5.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2011-10-04 11:52:59 | Re: [REVIEW] pg_last_xact_insert_timestamp |
Previous Message | Shigeru Hanada | 2011-10-04 10:08:24 | Re: WIP: Join push-down for foreign tables |