pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PG 12 hstore creation cast issue
3+ messages / 2 participants
[nested] [flat]

* PG 12 hstore creation cast issue
@ 2019-10-30 16:35 Wells Oliver <wells.oliver@gmail.com>
  2019-10-30 17:55 ` Re: PG 12 hstore creation cast issue Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Wells Oliver @ 2019-10-30 16:35 UTC (permalink / raw)
  To: pgsql-admin

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?

-- 
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PG 12 hstore creation cast issue
  2019-10-30 16:35 PG 12 hstore creation cast issue Wells Oliver <wells.oliver@gmail.com>
@ 2019-10-30 17:55 ` Tom Lane <tgl@sss.pgh.pa.us>
  2019-10-30 17:57   ` Re: PG 12 hstore creation cast issue Wells Oliver <wells.oliver@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2019-10-30 17:55 UTC (permalink / raw)
  To: Wells Oliver <wells.oliver@gmail.com>; +Cc: 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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PG 12 hstore creation cast issue
  2019-10-30 16:35 PG 12 hstore creation cast issue Wells Oliver <wells.oliver@gmail.com>
  2019-10-30 17:55 ` Re: PG 12 hstore creation cast issue Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-10-30 17:57   ` Wells Oliver <wells.oliver@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Wells Oliver @ 2019-10-30 17:57 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

Yeah. Dang, hoist by own convenience petard. My own doing, folks.

Appreciate the detail.

On Wed, Oct 30, 2019 at 10:55 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> 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
>


-- 
Wells Oliver
wells.oliver@gmail.com <wellsoliver@gmail.com>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-10-30 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 16:35 PG 12 hstore creation cast issue Wells Oliver <wells.oliver@gmail.com>
2019-10-30 17:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-10-30 17:57   ` Wells Oliver <wells.oliver@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox