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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to