Re: Feeding results back into select

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Feeding results back into select
Date: 2008-08-23 12:40:20
Message-ID: 20080823084020.16e8ebe4.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 23 Aug 2008 14:04:30 +0400
Teodor Sigaev <teodor(at)sigaev(dot)ru> wrote:
> >> select 'a'=>'b';
> >> ?column?
> >> ----------
> >> "a"=>"b"
> "a"=>"b" is a value of hstore type, so query should be:
> select '"a"=>"b"'::hstore;

Of course. Now that I understand it's blindingly obvious that the
double quotes above are part of the string and the insert would be;
INSERT INTO table (hfield) VALUES ('"a"=>"b"');

> " character was chosen to simplify escaping,

To prevent;
INSERT INTO table (hfield) VALUES ('''a''=>''b''');

I guess my brain was pointed elsewhere when I asked. Thanks for not
treating me like an idiot. :-)

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2008-08-23 13:52:54 Re: [GENERAL] Surprising syntax error
Previous Message Peter Eisentraut 2008-08-23 12:38:50 Re: [GENERAL] Surprising syntax error