Re: Question about SQL statement error - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Question about SQL statement error
Date
Msg-id 1093435008.15248.217.camel@linda
Whole thread Raw
In response to Question about SQL statement error  (Mário Gamito <gamito@netual.pt>)
List 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@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
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


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Question about SQL statement error
Next
From: Gaetano Mendola
Date:
Subject: Re: Question about SQL statement error