Re: sql files in psql ?

From: Mariateresa L <mariateresa(dot)ll(at)bresciaonline(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: sql files in psql ?
Date: 2010-06-01 20:33:51
Message-ID: 4C056EAF.7080308@bresciaonline.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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).
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bret Fledderjohn 2010-06-01 20:45:27 Re: Putting an aggregate value in an UPDATE statement...
Previous Message John Gage 2010-06-01 20:28:36 Putting an aggregate value in an UPDATE statement...