Re: \copy combine with SELECT

From: "jia ding" <dingjia(at)gmail(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, Chris <dmagick(at)gmail(dot)com>, "jia ding" <dingjia(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: \copy combine with SELECT
Date: 2006-03-17 16:58:12
Message-ID: 91ae6e350603170858k39e05da9q9447ef941b55089c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Martijn.

\d test
Table "public.test"
Column | Type | Modifiers
id | integer |
score | integer |

I tried \copy test (score) to test.txt. It works well.

But, suppose I want to select rows with score > 20 (just an example).
Then,\copy table [ ( column_list ) ] { from | to } filename doesn't
help much.

Have a nice weekend!

N

On 3/17/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Fri, Mar 17, 2006 at 10:45:16AM +1100, Chris wrote:
> > Doesn't look like \copy lets you specify which fields to include though.
>
> Ofcourse it does, you just need to use parenthesis. From the manpage:
>
> \copy table [ ( column_list ) ] { from | to } filename | stdin | stdout
> [ with ] [ oids ] [ delimiter [as] 'character' ] [ null [as] 'string' ]
>
> Have a nice day,
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> > tool for doing 5% of the work and then sitting around waiting for someone
> > else to do the other 95% so you can sue them.
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
>
> iD8DBQFEGt++IB7bNG8LQkwRAvRlAJ9b3KJX82JviBnhTmexPa6nJlP2iACcD6gl
> 5jLonNJA7sZpl1jxY+LQQ1E=
> =eepY
> -----END PGP SIGNATURE-----
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Fraser 2006-03-17 17:16:38 Re: PostgreSQL scalability concerns
Previous Message Kenneth Downs 2006-03-17 16:51:35 Re: pgsql variables from records