From: | Chris Gamache <cgg007(at)yahoo(dot)com> |
---|---|
To: | "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: copy limited number of records |
Date: | 2002-11-04 16:10:22 |
Message-ID: | 20021104161022.80886.qmail@web13802.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)lfix(dot)co(dot)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(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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Kyle Cheng | 2002-11-04 17:54:41 | Question about Vacuum, Index, perfromance, future xml support in postgresql |
Previous Message | Christoph Dalitz | 2002-11-04 16:02:41 | Re: novice question about current_time() |