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

From: Greg Williamson <gwilliamson39(at)yahoo(dot)com>
To:
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: ERROR: syntax error at or near ":"
Date: 2013-03-07 01:04:50
Message-ID: 1362618290.62197.YahooMailNeo@web125904.mail.ne1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for the link / explanation -- hadn't seen this use before.

GW

----- Original Message -----
> From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
> To: Greg Williamson <gwilliamson39(at)yahoo(dot)com>
> Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
> Sent: Wednesday, March 6, 2013 3:13 PM
> Subject: Re: [GENERAL] ERROR: syntax error at or near ":"
>
> On 03/06/2013 03:04 PM, Greg Williamson wrote:
>>
>>
>> Graham --
>>
>>> ________________________________
>>> From: Graham Leggett <minfrin(at)sharp(dot)fm>
>>> To: "pgsql-general(at)postgresql(dot)org"
> <pgsql-general(at)postgresql(dot)org>
>>> Sent: Wednesday, March 6, 2013 2:41 PM
>>> Subject: [GENERAL] ERROR:  syntax error at or near ":"
>>>
>>> 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...
>>>                                       ^
>>>
>> The colon (":") is not needed, just remove it. A pair of colons
> is used to indicate a cast of a value; off hand I am not coming up with any use
> of a colon in basic SQL.
>
> http://www.postgresql.org/docs/9.2/interactive/app-psql.html#APP-PSQL-INTERPOLATION
>
>>
>> Greg W.
>>
>>
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-03-07 01:15:42 Re: ERROR: syntax error at or near ":"
Previous Message Graham Leggett 2013-03-07 00:58:45 Re: ERROR: syntax error at or near ":"