Re: Overriding default psql behavior | how to ignore missing fields - Mailing list pgsql-general

From Jasen Betts
Subject Re: Overriding default psql behavior | how to ignore missing fields
Date
Msg-id iflha6$723$1@reversiblemaps.ath.cx
Whole thread Raw
In response to Overriding default psql behavior | how to ignore missing fields  (Håvard Wahl Kongsgård <haavard.kongsgaard@gmail.com>)
List pgsql-general
On 2010-12-31, Håvard Wahl Kongsgård <haavard.kongsgaard@gmail.com> wrote:
> --90e6ba488359a7721f0498b43825
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: quoted-printable
>
> Hi,
> I am trying to insert new records from multiple SQL dumps into an existing
> table. My problem is that the database table does not have some of the
> columns used in the sql dumps. So when I try to import the dumps psql fails
> with: "ERROR:  current transaction is aborted, commands ignored until end o=
> f
> transaction block"
>
> As there are thousands of files with multiple missing fields, manually
> adding every field to the table is not a option.

In that case you'll need to do that automatically (write some software),
or find some other way to load the data.

> Is it possible to overriding the default psql behavior, so that the sql
> session simply ignores any missing fields?

no.


Perhaps load the tables into a temporary database and then copy the
columns you want, or drop the columns you dont and dump the whole
thing...

--
⚂⚃ 100% natural

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: seg fault crashed the postmaster
Next
From: Adrian Klaver
Date:
Subject: Re: Overriding default psql behavior | how to ignore missing fields