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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 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

In response to

Browse pgsql-general by date

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