Re: [GENERAL] \copy combine with SELECT

2006-03-18 Thread jia ding
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

Re: [GENERAL] \copy combine with SELECT

2006-03-17 Thread Martijn van Oosterhout
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 ] [ delim

Re: [GENERAL] \copy combine with SELECT

2006-03-16 Thread Chris
jia ding wrote: yes, of couse COPY but, => copy test to 'test.txt'; ERROR: must be superuser to COPY to or from a file HINT: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone. Straight from the documentation: Do not confuse COPY with the psql instruction \

Re: [GENERAL] \copy combine with SELECT

2006-03-16 Thread jia ding
yes, of couse COPYbut,=> copy test to 'test.txt';ERROR:  must be superuser to COPY to or from a fileHINT:  Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone. On 3/16/06, Chris <[EMAIL PROTECTED]> wrote: jia ding wrote:> Hi all,>> I tried:> select id, name  into tab

Re: [GENERAL] \copy combine with SELECT

2006-03-15 Thread Qingqing Zhou
""jia ding"" <[EMAIL PROTECTED]> wrote > I tried: > select id, name into table2 from table1; > \copy table2 to filename.txt > in order to export 2 columns from table1 to a file. > > But, I am thinking, if there is a command can combine these two > command together? Notice that COPY command c

Re: [GENERAL] \copy combine with SELECT

2006-03-15 Thread Chris
jia ding wrote: Hi all, I tried: select id, name into table2 from table1; \copy table2 to filename.txt in order to export 2 columns from table1 to a file. But, I am thinking, if there is a command can combine these two command together? Maybe, something like: \copy select id,name from ta

[GENERAL] \copy combine with SELECT

2006-03-15 Thread jia ding
Hi all,I tried: select id, name  into table2   from table1; \copy table2 to filename.txt in order to export 2 columns from table1 to a file.But, I am thinking, if there is a command can combine these two command together? Maybe, something like: \copy select id,name  from table  to filename.txt ?Nin