pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: PG 12 hstore creation cast issue
Date: Wed, 30 Oct 2019 13:55:52 -0400
Message-ID: <7303.1572458152@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOC+FBW30umnGfRkc8BD-tr-KrPZFPAd-zr19AdSrRTKCv67Pw@mail.gmail.com>
References: <CAOC+FBW30umnGfRkc8BD-tr-KrPZFPAd-zr19AdSrRTKCv67Pw@mail.gmail.com>

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





view thread (3+ messages)  latest in thread

Message-ID: <7303.1572458152@sss.pgh.pa.us>
Permalink:  ../7303.1572458152@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7303.1572458152@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wells.oliver@gmail.com
  Subject: Re: PG 12 hstore creation cast issue
  In-Reply-To: <7303.1572458152@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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