On 07/04/2017 04:16 AM, Moreno Andreo wrote:
> I've implemented a backup procedure in C# with Npgsql (using COPY TO I
> dump all tables in a compressed file) that's been working well in the
> last 5 years (and it's still working, since this is a single, isolated
> case).
>
> OS: Windows 7
> PG: 9.1.6 (I know, it's EOL, but I think it's not matter here)
Are you restoring to same as above or to another machine or Postgres
instance?
>
> While restoring (with COPY FROM) I get this error:
> 2017-07-04 12:55:27 CEST ERROR: invalid field size
> 2017-07-04 12:55:27 CEST CONTEXT: COPY tab, line 619, column thumbnail
> 2017-07-04 12:55:27 CEST STATEMENT: COPY
> tab(cod,guid,data,blob,thumbnail,descr,type,url,user,home,codrec,table,op,dagg,last)
> FROM STDIN WITH BINARY
>
> with this table definition:
>
> CREATE TABLE public.tab
> (
> cod uuid NOT NULL DEFAULT uuid_generate_v4(),
> guid uuid NOT NULL,
> data timestamp without time zone NOT NULL,
> blob bytea,
> thumbnail bytea,
> descr character varying(255) DEFAULT NULL::character varying,
> type character varying(50) DEFAULT NULL::character varying,
> url character varying(255) DEFAULT NULL::character varying,
> user character varying(255) DEFAULT NULL::character varying,
> home character varying(255) DEFAULT NULL::character varying,
> codrec uuid,
> table character varying(30) DEFAULT NULL::character varying,
> op character(1) DEFAULT NULL::bpchar,
> dagg timestamp without time zone,
> last character varying(16) DEFAULT NULL::character varying
> )
>
> As you can see I have 2 bytea fields, blob and thumbnail (the one it
> seems it's giving the error), but AFAIK the former is never used, so it
> should be always null.
> Googling around did not help.
>
> Any ideas? As for many error I got in the past I assume we are trying to
> COPY FROM corrupted data (when using cheap pendrives we get often this
> error). Should it be reasonable or I have to search elsewhere?
>
> Thanks in advance
> Moreno.
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com