Re: Feeding results back into select (was: proposal sql: labeled function params) - Mailing list pgsql-hackers

From D'Arcy J.M. Cain
Subject Re: Feeding results back into select (was: proposal sql: labeled function params)
Date
Msg-id 20080822164619.71bc4e87.darcy@druid.net
Whole thread Raw
In response to Re: proposal sql: labeled function params  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: Feeding results back into select  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers
On Sat, 23 Aug 2008 00:03:16 +0400
Teodor Sigaev <teodor@sigaev.ru> wrote:
> select 'a'=>'b';
>    ?column?
> ----------
>    "a"=>"b"

Branching the topic, I have a question about this.  I haven't studied
hstore extensively but this seems like a problem on it's face.
Shouldn't you be able to take the result of a select and pass it back
to a select?  I mean, what happens if you do this?

select "a"=>"b";

I suspect that you would get "ERROR:  column "a" does not exist" if you
do that.  What happens when you try to restore a dump?

I ran into a similar issue with my chkpass type (see contrib) where the
string inserted into the field is stored encrypted with functions to
test for equality basically like the Unix password model works.  If I
just displayed raw strings then a dump and reload would have trashed
all the passwords by re-encrypting them.  What I did was to make a
special case on input.  If the string started with ':' then I strip
that character and insert the string unchanged.  Then I changed the
output to prepend the ':'.  Now dump and reload work.

Just curious.

-- 
D'Arcy J.M. Cain <darcy@druid.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.


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: proposal sql: labeled function params
Next
From: Tatsuo Ishii
Date:
Subject: Re: WITH RECURSIVE patches 0818