Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group