Thread: hstore: null value is treated as empty string by avals function

hstore: null value is treated as empty string by avals function

From
Alexey Bashtanov
Date:
hstore: null value is treated as empty string by avals function

# select avals('gfds'=>null) = array[null], avals('gfds'=>null) =
array[''], version();
 ?column? | ?column? |
    version

----------+----------+------------------------------------------------------------------------------------------------------------------
 f        | t        | PostgreSQL 8.4.4 on x86_64-redhat-linux-gnu,
compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
(1 row)

got f,t
expected t,f
hope the problem is clear

regards,
 Alexey

Re: hstore: null value is treated as empty string by avals function

From
Itagaki Takahiro
Date:
On Mon, Sep 27, 2010 at 2:36 PM, Alexey Bashtanov <bashtanov@nasvete.ru> wr=
ote:
> hstore: null value is treated as empty string by avals function
>
> # select avals('gfds'=3D>null) =3D array[null], avals('gfds'=3D>null) =3D
> array[''], version();
> =C2=A0?column? | ?column? |
> =C2=A0 =C2=A0version
> ----------+----------+---------------------------------------------------=
---------------------------------------------------------------
> =C2=A0f =C2=A0 =C2=A0 =C2=A0 =C2=A0| t =C2=A0 =C2=A0 =C2=A0 =C2=A0| Postg=
reSQL 8.4.4 on x86_64-redhat-linux-gnu,
> compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
> (1 row)
>
> got f,t
> expected t,f
> hope the problem is clear

I found 9.0 and 9.1dev returns t,f as expected.
Is it an incompatibility between 8.4 and 9.0?

--=20
Itagaki Takahiro

Re: hstore: null value is treated as empty string by avals function

From
Robert Haas
Date:
On Mon, Sep 27, 2010 at 4:34 AM, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> On Mon, Sep 27, 2010 at 2:36 PM, Alexey Bashtanov <bashtanov@nasvete.ru> =
wrote:
>> hstore: null value is treated as empty string by avals function
>>
>> # select avals('gfds'=3D>null) =3D array[null], avals('gfds'=3D>null) =
=3D
>> array[''], version();
>> =A0?column? | ?column? |
>> =A0 =A0version
>> ----------+----------+--------------------------------------------------=
----------------------------------------------------------------
>> =A0f =A0 =A0 =A0 =A0| t =A0 =A0 =A0 =A0| PostgreSQL 8.4.4 on x86_64-redh=
at-linux-gnu,
>> compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit
>> (1 row)
>>
>> got f,t
>> expected t,f
>> hope the problem is clear
>
> I found 9.0 and 9.1dev returns t,f as expected.
> Is it an incompatibility between 8.4 and 9.0?

Yeah, seems to be.  As far as I can see, the 8.4 behavior is flat-out wrong.

rhaas=3D# select avals(hstore('gfds', null::text));
 avals
-------
 {""}
(1 row)

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company