Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UQ0l8-0005uh-7e for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Apr 2013 19:32:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UQ0l7-0007o8-OV for pgsql-bugs@arkaria.postgresql.org; Wed, 10 Apr 2013 19:32:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UQ0l7-0007o3-6M for pgsql-bugs@postgresql.org; Wed, 10 Apr 2013 19:32:41 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UQ0kz-0004Re-RC for pgsql-bugs@postgresql.org; Wed, 10 Apr 2013 19:32:40 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id r3AJWQ903067 for ; Wed, 10 Apr 2013 12:32:26 -0700 Message-ID: <5165BE48.6040309@hogranch.com> Date: Wed, 10 Apr 2013 12:32:24 -0700 From: John R Pierce User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: BUG #8056: postgres forgets hstore over time References: <1365616876.67955.YahooMailNeo@web140203.mail.bf1.yahoo.com> In-Reply-To: <1365616876.67955.YahooMailNeo@web140203.mail.bf1.yahoo.com> Content-Type: multipart/alternative; boundary="------------020806010305070507010102" X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------020806010305070507010102 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 4/10/2013 11:01 AM, E E wrote: > > CREATE OR REPLACE FUNCTION accounts.myhstore_merge(myh hstore, mytext > text[]) > RETURNS hstore AS > $BODY$BEGIN > SET search_path TO public; > RETURN myh || hstore(mytext); > > END;$BODY$ > LANGUAGE plpgsql VOLATILE > COST 100; public.hstore(...) would have been much simpler than changing the search_path, which is persistent to the connection and likely will backfire if your apps are changing it to something else. -- john r pierce 37N 122W somewhere on the middle of the left coast --------------020806010305070507010102 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 4/10/2013 11:01 AM, E E wrote:

CREATE OR REPLACE FUNCTION accounts.myhstore_merge(myh hstore, mytext text[])
  RETURNS hstore AS
$BODY$BEGIN
SET search_path TO public;
RETURN myh || hstore(mytext);

END;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;


public.hstore(...)    would have been much simpler than changing the search_path, which is persistent to the connection and likely will backfire if your apps are changing it to something else.



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast
--------------020806010305070507010102--