Re: Feeding results back into select (was: proposal sql: labeled function params)

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 (was: proposal sql: labeled function params)
Date: 2008-08-22 20:46:19
Message-ID: 20080822164619.71bc4e87.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 23 Aug 2008 00:03:16 +0400
Teodor Sigaev <teodor(at)sigaev(dot)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(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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2008-08-23 02:33:13 Re: [HACKERS] WITH RECURSIVE patches 0818
Previous Message Teodor Sigaev 2008-08-22 20:03:16 Re: proposal sql: labeled function params