Skip site navigation (1) Skip section navigation (2)

Re: Question about SQL statement error

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Mário Gamito <gamito(at)netual(dot)pt>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question about SQL statement error
Date: 2004-08-25 11:56:48
Message-ID: 1093435008.15248.217.camel@linda (view raw, whole thread or download thread mbox)
Lists: pgsql-general
On Wed, 2004-08-25 at 12:37, Mário Gamito wrote:
> Hi,
> I'm a newbie at postgreSQL, although i have years of experience with MySQL.
> My question is (and i tried to found the answer):
> why this gives an error ?
> SELECT url_negado INTO OUTFILE '/tmp/urls_negados.txt' FROM urls_negados;
> Any help would be appreciated.

It isn't valid PostgreSQL syntax.  PostgreSQL tries to stick to SQL
standards as far as possible.  Use SELECT INTO to create a new table.

To dump to a flat file, use COPY:

  COPY urls_negado (url_negado) TO '/tmp/urls_negados.txt';

Nulls will be represented as \N

Oliver Elphick                                          olly(at)lfix(dot)co(dot)uk
Isle of Wight                    
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
     "But the day of the Lord will come as a thief in the 
      night. The heavens shall pass away with a great noise,
      and the elements shall melt with fervent heat, and the
      earth and the works that are therein shall be burned
      up."                     II Peter 3:10 

In response to

pgsql-general by date

Next:From: David Suela FernándezDate: 2004-08-25 12:35:48
Subject: copy a database
Previous:From: Gaetano MendolaDate: 2004-08-25 11:55:11
Subject: Re: Question about SQL statement error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group