Re: BUG #4944: Problems with using \set variables as strings in select statements - Mailing list pgsql-bugs

From Rolf Jentsch
Subject Re: BUG #4944: Problems with using \set variables as strings in select statements
Date
Msg-id 200907271631.19416.RJentsch@electronicpartner.de
Whole thread Raw
In response to BUG #4944: Problems with using \set variables as strings in select statements  ("Bruno Scovoli Santos" <bruno.scovoli@gmail.com>)
List pgsql-bugs
Hallo Bruno,

Am Montag, 27. Juli 2009 15:50 schrieb Bruno Scovoli Santos:

>...
> brunodb=3D# \set nom 'Intel'
> euclidhardware=3D# select * from fabricantes where nome like :nom;
> ERROR:  column "intel" does not exist
> LINE 1: select * from fabricantes where nome like Intel;
>
> Please, I have tried exaustively many other ways to achieve this result,
> and searched many foruns. I dont realize where is my error, I think that =
it
> is a bug?
>
> Thanks in advance,
>
> Bruno

The syntax for \set with strings is a bit bizarre. You have to use either
\set nom '\'Intel\''
or
\set nom '''Intel'''

cu
Rolf Jentsch
Entwicklung Mitglieder-Systeme Dezentral

ElectronicPartner GmbH
M=C3=BCndelheimer Weg 40
40472 D=C3=BCsseldorf

phone: +49-(0)211-4156-0
fax: +49-(0)211-4156-6865
eMail: rjentsch@electronicpartner.de

Sitz der Gesellschaft D=C3=BCsseldorf
Amtsgericht - Registergericht D=C3=BCsseldorf - HRB 4078
Gesch=C3=A4ftsf=C3=BChrer: Dr. J=C3=B6rg Ehmer, Oliver Haubrich,=20
Dr. Sven-Olaf Krau=C3=9F, Karl Trautmann

pgsql-bugs by date:

Previous
From: "fous"
Date:
Subject: BUG #4943: getting error while vacuuming the database
Next
From: "dan boeriu"
Date:
Subject: BUG #4945: Parallel update(s) gone wild