Re: Identical command-line command will not work with \i metacommand and filename

From: Scott Mead <scott(dot)lists(at)enterprisedb(dot)com>
To: John Gage <jsmgage(at)numericable(dot)fr>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Identical command-line command will not work with \i metacommand and filename
Date: 2010-04-22 01:34:17
Message-ID: t2hd3ab2ec81004211834z83bfec20t153b01554e4a7929@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-general

On Wed, Apr 21, 2010 at 6:07 PM, John Gage <jsmgage(at)numericable(dot)fr> wrote:

> I enter the identical command:
>
> select * from mesh_descriptors;
>
> using the psql command line and it works perfectly.
>
> The same command in a file produces an immediate syntax error:
>
> EFNWeb=# \i ./CopySql.sql
> psql:./CopySql.sql:1: ERROR: syntax error at or near "select"
> LINE 1: select * from mesh_descriptors;
>
> when run from a file using \i
>
> What am I doing wrong?
>

Do you have some funky hidden characters at the beginning of the file?

run:

od -a CopySql.sql

Look at the beginning, that'll show you character by character what's in
there (should reveal anything hidden).

--Scott

>
> Thanks,
>
> John Gage
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message John Gage 2010-04-22 07:24:05 Re: Identical command-line command will not work with \i metacommand and filename
Previous Message John Gage 2010-04-21 22:07:10 Identical command-line command will not work with \i metacommand and filename

Browse pgsql-general by date

  From Date Subject
Next Message Glen Parker 2010-04-22 01:38:15 Re: trying to write a bit of logic as one query, can't seem to do it under 2
Previous Message Jonathan Vanasco 2010-04-22 01:21:57 Re: trying to write a bit of logic as one query, can't seem to do it under 2