Re: ERROR: syntax error at or near ":"

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Graham Leggett <minfrin(at)sharp(dot)fm>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: syntax error at or near ":"
Date: 2013-03-06 23:09:39
Message-ID: 5137CCB3.5070603@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/06/2013 02:41 PM, Graham Leggett wrote:
> Hi all,
>
> I have a text file, and I need to update the value of an element in a table with the contents of this text file. Following the instructions at http://stackoverflow.com/questions/10968039/postgresql-inserting-value-of-a-column-from-a-file I tried this, but get the error below, which I do not understand.
>
> Can anyone explain what might be going wrong, and what I should do instead?
>
> patricia=# \set content `cat /tmp/certificates.txt`
> patricia=# update property set value = :'content' where key = 'patricia.home.security.cacerts';
> ERROR: syntax error at or near ":"
> LINE 1: update property set value = :'content' where key = 'patricia...
> ^

Worked here for me. Is the field you are trying to set really named
value? Even though VALUE is marked non-reserved here:

http://www.postgresql.org/docs/9.2/interactive/sql-keywords-appendix.html

you might want to follow the advice from above link:

"
As a general rule, if you get spurious parser errors for commands that
contain any of the listed key words as an identifier you should try to
quote the identifier to see if the problem goes away.
"

>
> Regards,
> Graham
> --
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-03-06 23:10:23 Re: ERROR: syntax error at or near ":"
Previous Message Ian Lawrence Barwick 2013-03-06 23:05:55 Re: ERROR: syntax error at or near ":"