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

From Chris Gamache
Subject Re: copy limited number of records
Date
Msg-id 20021104161022.80886.qmail@web13802.mail.yahoo.com
Whole thread Raw
In response to Re: copy limited number of records  (Oliver Elphick <olly@lfix.co.uk>)
List pgsql-general
SELECT * INTO t_test_table_out FROM t_test_table LIMIT 10;
COPY t_test_table_out TO '/usr/local/home/admin/dev_tbls' USING DELIMITERS ',';
DROP TABLE t_test_table_out;

HTH,

CG

--- Oliver Elphick <olly@lfix.co.uk> wrote:
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)


__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

pgsql-general by date:

Previous
From: Christoph Dalitz
Date:
Subject: Re: novice question about current_time()
Next
From: Michelle Konzack
Date:
Subject: Re: Announcement: New German PostgreSQL book