Re: copy limited number of records

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy limited number of records
Date: 2002-11-04 15:47:42
Message-ID: 1036424862.1106.323.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-11-04 15:50:29 Re: unique in two not so unique columns
Previous Message Johnson, Shaunn 2002-11-04 15:46:00 novice question about current_time()