Re: sql files in psql ? - Mailing list pgsql-novice

From Mariateresa L
Subject Re: sql files in psql ?
Date
Msg-id 4C056EAF.7080308@bresciaonline.it
Whole thread Raw
In response to Re: sql files in psql ?  (Joe Brenner <doom@kzsu.stanford.edu>)
List pgsql-novice
Well, I thank everyone for the quick answers, and my apologies for the
duplicate message (my mistake).

I've found the culprit ! I wrote some text files with simple commands
for psql (\dt, \l etc...) then, having so checked my first script, I
replaced the test ones with other files containing SQL queries; these
gave me "syntax error at or near SELECT", with the error caret pointing
left of S of SELECT.
After your skeptical remarks (thanks !) I checked both kind of files
with an hex editor, finding that some of the "SQL" ones had a couple of
non printable characters before the correct string, and gedit ignores
them without warning.
These files where not been written afresh; have suffered some migration
from a disk to another a couple of times in the last months and probably
have been corrupted.

Sorry for having bothered this list and thank again to everyone.

Fabio

Il 31/05/2010 23.37, Joe Brenner ha scritto:
.
.
>
> If I understand what you're saying, I can't reproduce the problem.
>
> With a "tmp.sql" containing:
>
>    create table nameo (nameo text);
>    insert into nameo (nameo) VALUES ('bingo'), ('bonzo'), ('bang');
>    select * from nameo;
>
> I see this behavior:
>
> psql --file tmp.sql
> CREATE TABLE
> INSERT 0 3
>
> -------
> (3 rows)
>   bang
>   bingo
>   bonzo
>   nameo
>
>
> I'm on ununtu jaunty, using bash and PostgreSQL 8.3.7.
>
>> P.S. Initially I discarded the use of procedural
>> languages (C or ...) for a quick and simpler solution !
>
> Myself, I wouldn't try to put together a db-backed app without
> a glue language (e.g. perl).
>


pgsql-novice by date:

Previous
From: John Gage
Date:
Subject: Putting an aggregate value in an UPDATE statement...
Next
From: Bret Fledderjohn
Date:
Subject: Re: Putting an aggregate value in an UPDATE statement...