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).
>