Re: PG 12 hstore creation cast issue - Mailing list pgsql-admin

From Tom Lane
Subject Re: PG 12 hstore creation cast issue
Date
Msg-id 7303.1572458152@sss.pgh.pa.us
Whole thread Raw
In response to PG 12 hstore creation cast issue  (Wells Oliver <wells.oliver@gmail.com>)
Responses Re: PG 12 hstore creation cast issue  (Wells Oliver <wells.oliver@gmail.com>)
List pgsql-admin
Wells Oliver <wells.oliver@gmail.com> writes:
> We have this kind of code that worked in 9.6:

> select hstore(array['foo'], array[1.0::numeric]);

> But now yields:

> ERROR:  function hstore(text[], numeric[]) does not exist
> LINE 1: select hstore(array['foo'], array[1.0::numeric]);
>                ^
> HINT:  No function matches the given name and argument types. You might
> need to add explicit type casts.

> Is there a way to create hstores with numeric types as data? Does
> everything need to be cast as text?

For me, that query fails that way in 9.6 too.  This is unsurprising
because the only two-argument variants of hstore() are

    hstore(text, text)
    hstore(text[], text[])

both in 9.6 and current.  I suppose that this case was getting
covered by one of those implicit casts you got rid of, allowing
numeric[] to be silently cast to text[].

            regards, tom lane



pgsql-admin by date:

Previous
From: Wells Oliver
Date:
Subject: PG 12 hstore creation cast issue
Next
From: Wells Oliver
Date:
Subject: Re: PG 12 hstore creation cast issue