Lists: | pgsql-bugs |
---|
From: | "Oleg Serov" <serovov(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug in pl/pgsql with hstore OR bug in pl/pgsql IF (text field is boolean?) |
Date: | 2008-10-27 14:08:35 |
Message-ID: | cec7c6df0810270708w896e19fgf7eb4a3c1a9d06d5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
I can't get hstore value by key. i have very interesting error
DEMO SQL CODE:
------------------------------------------------------------------------------
ROLLBACK;
BEGIN;
-- VERSION INFO
SELECT VERSION();
-- RESULT:
-- PostgreSQL 8.3.4 on i686-redhat-linux-gnu, compiled by GCC gcc
(GCC) 4.1.2 20071124 (Red Hat 4.1.2-42)
-- TEST FOR HSTORE:
SELECT (('test' => 'testvalue')::hstore)->'test'; -- HSTORE WORKS!
-- HSTORE OK;
-- BUG REPRODUCTION FUNCTION
CREATE OR REPLACE FUNCTION "hstore_bug" () RETURNS pg_catalog.void AS
$body$
DECLARE
res HSTORE;
BEGIN
res := ('test' => NULL)::hstore;
IF res->'test' IS NULL THEN
RAISE EXCEPTION 'HSTORE IS OK';
END IF;
RAISE EXCEPTION 'HSTORE IS BUGGY';
END;
$body$
LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY DEFINER;
--- BUG REPRODUCTION:
SELECT hstore_bug();
-- ERROR MSG
-- ERROR: operator does not exist: hstore -> boolean
-- LINE 1: SELECT $1 ->'test' IS NULL
-- ^
-- HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.
-- QUERY: SELECT $1 ->'test' IS NULL
-- CONTEXT: PL/pgSQL function "hstore_bug" line 6 at IF
From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Oleg Serov <serovov(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Bug in pl/pgsql with hstore OR bug in pl/pgsql IF (text field is boolean?) |
Date: | 2008-10-27 14:14:46 |
Message-ID: | 20081027141446.GA29664@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Mon, Oct 27, 2008 at 05:08:35PM +0300, Oleg Serov wrote:
> I can't get hstore value by key. i have very interesting error
the problem is that -> has very low priority, but you work with it
anyway:
# select tconvert('a', 'b')->'a' is null;
ERROR: operator does not exist: hstore -> boolean
LINE 1: select tconvert('a', 'b')->'a' is null;
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
(depesz(at)[local]:5840) 15:14:03 [depesz]
# select (tconvert('a', 'b')->'a') is null;
?column?
----------
f
(1 row)
depesz
--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
From: | "Oleg Serov" <serovov(at)gmail(dot)com> |
---|---|
To: | depesz(at)depesz(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Bug in pl/pgsql with hstore OR bug in pl/pgsql IF (text field is boolean?) |
Date: | 2008-10-27 14:20:30 |
Message-ID: | cec7c6df0810270720x1f21ad3eoaa6156281791780b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Ok, thanks... it is not a bug;
2008/10/27 hubert depesz lubaczewski <depesz(at)depesz(dot)com>:
> On Mon, Oct 27, 2008 at 05:08:35PM +0300, Oleg Serov wrote:
>> I can't get hstore value by key. i have very interesting error
>
> the problem is that -> has very low priority, but you work with it
> anyway:
> # select tconvert('a', 'b')->'a' is null;
> ERROR: operator does not exist: hstore -> boolean
> LINE 1: select tconvert('a', 'b')->'a' is null;
> ^
> HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
> (depesz(at)[local]:5840) 15:14:03 [depesz]
> # select (tconvert('a', 'b')->'a') is null;
> ?column?
> ----------
> f
> (1 row)
>
> depesz
>
> --
> Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
> jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
>