Re: copy limited number of records - Mailing list pgsql-general

From Oliver Elphick
Subject Re: copy limited number of records
Date
Msg-id 1036424862.1106.323.camel@linda
Whole thread Raw
In response to copy limited number of records  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Responses Re: copy limited number of records  (Chris Gamache <cgg007@yahoo.com>)
List pgsql-general
On Mon, 2002-11-04 at 15:02, Johnson, Shaunn wrote:
> Howdy:
>
> Running PostgreSQL 7.2.1 on RedHat Linux 7.2.
>
> I'm using copy to create a bunch of flat files with delimiters
> and it's going okay.  I've been asked, however, that the clients
> don't actually want ALL of the data in the table; perhaps about
> 100 or so records for testing.
>
> Is there a way to use limit while using the \copy command?
> (e.g., \copy t_test_tbl to '/usr/local/home/admin/dev_tbls' using delimiters
> ',' limit 10)
>
> I know the above doesn't work, but, perhaps there is a work around?

You can use Unix commands:

head -100 /usr/local/home/admin/dev_tbls |
    psql -d your_db -c "COPY t_test_tbl FROM STDIN"

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Lo, children are an heritage of the LORD; and the
      fruit of the womb is his reward."        Psalms 127:3


pgsql-general by date:

Previous
From: "Johnson, Shaunn"
Date:
Subject: novice question about current_time()
Next
From: Jean-Luc Lachance
Date:
Subject: Re: unique in two not so unique columns