Re: selective copy

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Matthew Nuzum <cobalt(at)bearfruit(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: selective copy
Date: 2003-02-27 15:28:14
Message-ID: Pine.LNX.4.21.0302271527270.8354-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


select c1 || '\t' || c2 || '\t' || c3 from mytable where a = 3;

On Thu, 27 Feb 2003, Matthew Nuzum wrote:

> Hey group,
> I know you can't do a selective copy but I was wondering if someone can
> suggest the most effective way to get the same result.
>
> What I have is a lot of text data with unknown characters. Quotes,
> apostrophes, carriage returns and etc. There could be hundreds or thousands
> of rows in the table but I only want one or two. I need to get the data
> into an external file so it can be transported to another database and
> re-inserted.
>
> What I've done in the past is dump the table's data using pg_dump -t table
> and using INSERTS instead of copy and then grep the results so that I only
> get the desired line. That only works when I'm using simple data that
> doesn't wrap to different lines.
>
> I'm doing this to restore data from a backup :`(
>
> --
> Matthew Nuzum
> www.bearfruit.org
> cobalt(at)bearfruit(dot)org
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

--
Nigel J. Andrews
Telephone: +44 (0) 208 941 1136

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Herbert Liechti 2003-02-27 15:30:06 pg_restore in debian postgresql 7.3.2-3
Previous Message Tom Lane 2003-02-27 15:27:31 Re: pg_restore in debian postgresql 7.3.2-3