Re: selective copy - Mailing list pgsql-general

From Nigel J. Andrews
Subject Re: selective copy
Date
Msg-id Pine.LNX.4.21.0302271527270.8354-100000@ponder.fairway2k.co.uk
Whole thread Raw
In response to selective copy  ("Matthew Nuzum" <cobalt@bearfruit.org>)
List 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@bearfruit.org
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_restore in debian postgresql 7.3.2-3
Next
From: Jeff Eckermann
Date:
Subject: Re: selective copy