Re: BUG #4944: Problems with using \set variables as strings in select statements

From: Rolf Jentsch <RJentsch(at)electronicpartner(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4944: Problems with using \set variables as strings in select statements
Date: 2009-07-27 14:31:19
Message-ID: 200907271631.19416.RJentsch@electronicpartner.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hallo Bruno,

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

>...
> brunodb=# \set nom 'Intel'
> euclidhardware=# 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ündelheimer Weg 40
40472 Düsseldorf

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

Sitz der Gesellschaft Düsseldorf
Amtsgericht - Registergericht Düsseldorf - HRB 4078
Geschäftsführer: Dr. Jörg Ehmer, Oliver Haubrich,
Dr. Sven-Olaf Krauß, Karl Trautmann

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-07-27 14:36:15 Re: BUG #4944: Problems with using \set variables as strings in select statements
Previous Message Bruno Scovoli Santos 2009-07-27 13:50:48 BUG #4944: Problems with using \set variables as strings in select statements