pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: error on line 1 trying to execute a script using psql
Date: Mon, 21 Jun 2010 21:44:56 +0000
Message-ID: <m3ocf42h7r.fsf@passepartout.tim-landscheidt.de> (raw)
References: <AANLkTikpLjmRR79VVEMH49RZTHzgEJcS-6sclTSmYP4O@mail.gmail.com>

Steven Dahlin <pgdb.sldahlin@gmail.com> wrote:

> I am attempting to generate a temporary function to execute some dml with
> the following script:

> create or replace function setuplicense() returns integer as $$
> declare
>   hwcustid  integer := 0;
>   retval    integer := 0;
> begin
>   insert into license.customer
>   ( customer_id ) values ( hwcustid );
>   commit;
>   return retval;
> end;
> $$
> LANGUAGE plpgsql;

> select setuplicense();

> When running this with psql I get the following:

> Error: syntax error at or near "create"

> Does anyone have a suggestion as to what is causing this?

Your editor prepends the file with a byte-order mark ("BOM")
that PostgreSQL chokes on (bug #5398). This will be fixed in
9.0 (cf.
<URI:http://developer.postgresql.org/pgdocs/postgres/release-9-0.html#AEN99331;);
until then you either have to configure your editor not to
save the BOM or chop off the first three bytes yourself
(with tail, sed, Perl & Co.).

Tim




view thread (3+ messages)  latest in thread

Message-ID: <m3ocf42h7r.fsf@passepartout.tim-landscheidt.de>
Permalink:  ../m3ocf42h7r.fsf@passepartout.tim-landscheidt.de/
Also on:    postgresql.org/message-id/m3ocf42h7r.fsf@passepartout.tim-landscheidt.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tim@tim-landscheidt.de
  Subject: Re: error on line 1 trying to execute a script using psql
  In-Reply-To: <m3ocf42h7r.fsf@passepartout.tim-landscheidt.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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