pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[ADMIN] syntax error for no apparent reason
4+ messages / 4 participants
[nested] [flat]

* [ADMIN] syntax error for no apparent reason
@ 2010-12-04 01:40  Willy-Bas Loos <willybas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Willy-Bas Loos @ 2010-12-04 01:40 UTC (permalink / raw)
  To: pgsql-admin; pgadmin-support@postgresql.org

Hi,

I've encountered this before, psql gives me a syntax error for no clear
reason. It's allways on the first character of a sql file.
I think that there must be some strange character code at the first
position, maybe it is because i share a ntfs partition with the windows
installation on my laptop and move files around.
I only editted this file with gedit, pgAdmin and vim on ubuntu lucid
desktop.

Here's the error:

postgres=# \i db02-vulling.sql
psql:db02-vulling.sql:1: ERROR:  syntax error at or near "begin"
LINE 1: begin;
        ^
INSERT 0 10100
INSERT 0 101
INSERT 0 100
psql:db02-vulling.sql:12: WARNING:  there is no transaction in progress
COMMIT
postgres=#


The file is in the attachment, both gzipped and as-is.
I hope someone can reproduce this.
(the code itself makes no sense but that's not relevant here)

WBL
-- 
"Patriotism is the conviction that your country is superior to all others
because you were born in it." -- George Bernard Shaw

Attachments:

db02-vulling.sql (text/x-sql, 262B) download begin; insert into a (val, description) select generate_series(100,200), 'dit is nummer '||generate_series(1,100); insert into c (val) select generate_series(200,300); insert into b (aid, cid) select generate_series(1,100), generate_series(1,100); commit;
db02-vulling.sql.gz (application/x-gzip, 168B) download ^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: [ADMIN] syntax error for no apparent reason
@ 2010-12-04 01:45  Josh Berkus <josh@agliodbs.com>
  parent: Willy-Bas Loos <willybas@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2010-12-04 01:45 UTC (permalink / raw)
  To: Willy-Bas Loos <willybas@gmail.com>; +Cc: pgsql-admin; pgadmin-support@postgresql.org


> I've encountered this before, psql gives me a syntax error for no clear
> reason. It's allways on the first character of a sql file.
> I think that there must be some strange character code at the first
> position, maybe it is because i share a ntfs partition with the windows
> installation on my laptop and move files around.

Yeah, this is caused by pgadmin adding a unicode marker at the first
position of the file.  If you uncheck "Read and Write Unicode UTF-8
Files" in the preferences, this issue should go away.


-- 
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [ADMIN] syntax error for no apparent reason
@ 2010-12-04 12:46  Guillaume Lelarge <guillaume@lelarge.info>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Guillaume Lelarge @ 2010-12-04 12:46 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: Willy-Bas Loos <willybas@gmail.com>; pgsql-admin; pgadmin-support@postgresql.org

Le 04/12/2010 02:45, Josh Berkus a écrit :
> 
>> I've encountered this before, psql gives me a syntax error for no clear
>> reason. It's allways on the first character of a sql file.
>> I think that there must be some strange character code at the first
>> position, maybe it is because i share a ntfs partition with the windows
>> installation on my laptop and move files around.
> 
> Yeah, this is caused by pgadmin adding a unicode marker at the first
> position of the file.  If you uncheck "Read and Write Unicode UTF-8
> Files" in the preferences, this issue should go away.
> 

It goes away because the file is no longer in UTF-8, and that may not be
what the OP wants.

I have a patch ready to be commited that will handle this. But you will
need next pgAdmin's release.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: [ADMIN] syntax error for no apparent reason
@ 2010-12-04 15:01  Kevin Grittner <Kevin.Grittner@wicourts.gov>
  0 siblings, 0 replies; 4+ messages in thread

From: Kevin Grittner @ 2010-12-04 15:01 UTC (permalink / raw)
  To: willybas@gmail.com; pgadmin-support@postgresql.org; pgsql-admin

Willy-Bas Loos  wrote:
 
> I've encountered this before, psql gives me a syntax error for no
> clear reason. It's allways on the first character of a sql file.
 
> The file is in the attachment
 
hexdump says the first three bytes of that file are:
 
ef bb bf
 
http://en.wikipedia.org/wiki/Byte_order_mark
 
-Kevin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2010-12-04 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-04 01:40 [ADMIN] syntax error for no apparent reason Willy-Bas Loos <willybas@gmail.com>
2010-12-04 01:45 ` Josh Berkus <josh@agliodbs.com>
2010-12-04 12:46   ` Guillaume Lelarge <guillaume@lelarge.info>
2010-12-04 15:01 Re: [ADMIN] syntax error for no apparent reason Kevin Grittner <Kevin.Grittner@wicourts.gov>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox