Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZR95E-0004Em-5K for pgsql-sql@arkaria.postgresql.org; Mon, 17 Aug 2015 01:19:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZR95D-0006eg-Bj for pgsql-sql@arkaria.postgresql.org; Mon, 17 Aug 2015 01:19:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZR94F-0005X5-20 for pgsql-sql@postgresql.org; Mon, 17 Aug 2015 01:18:27 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZR94A-0008Kg-2l for pgsql-sql@postgresql.org; Mon, 17 Aug 2015 01:18:26 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 29A0820D28 for ; Sun, 16 Aug 2015 21:18:19 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Sun, 16 Aug 2015 21:18:19 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=JPra3Is9NKoNmy8T13vE/jfinUU=; b=dxmCmW Q+7/TrHJHZqpU70uw6MPMH0LOLOBYyX6QMvqVZYrV9ZrGVIS0dDLGl8XJJJM0o9R nSo4schUQsxodkP++ndYZt5XrG93gtchemGhIW44XBhDO1kQFwhQUn6E8t+Ynlqi lx3grgm3bkyptZhMQGffMXBpTcWmkwBHZWD9Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=JPra3Is9NKoNmy8 T13vE/jfinUU=; b=l81bTVjWvA5pT/i2FP77dyEeM4OIl8JmNzY3OZH8YcvnLXd cWoWgUHcznQgk7qlCl3fC2EqzMM2bN/+OMl0TtL2jn/29tRmuduEv4Okm9MVHooU W0php3c47yy7tpbe18ql3e9oHwAzm4ThHaEC3FxMxa/yQDblrr5eIRnJVrVM= X-Sasl-enc: bURSZ90rpxaDXT18YKd5+j/r45jj8AU/cerJfSE7erZr 1439774298 Received: from [192.168.1.3] (174-21-248-106.tukw.qwest.net [174.21.248.106]) by mail.messagingengine.com (Postfix) with ESMTPA id 878BBC00027; Sun, 16 Aug 2015 21:18:18 -0400 (EDT) Subject: Re: ERROR: cache lookup failed for type To: Stuart , "pgsql-sql@postgresql.org" References: <55D131B0.6010500@gmail.com> From: Adrian Klaver Message-ID: <55D13641.20403@aklaver.com> Date: Sun, 16 Aug 2015 18:17:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55D131B0.6010500@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org On 08/16/2015 05:58 PM, Stuart wrote: > Hello all, > > I have been using a particular function for years without issue but > recently tried the Alpha releases of PostGreSQL. I loaded the database > into 9.5 Alpha1 release and did not have problems. After upgrading to > Alpha2, I started getting this error on executing the function. I didn't > reload the database this time as it should not be required. I do not see anything in the release notes about dump/restore, but this is an alpha so I would at least try dumping from the Alpha 1 and restoring to the Alpha 2. If nothing else it will provide another data point. > > ERROR: cache lookup failed for type 1082 > CONTEXT: compilation of PL/pgSQL function "ds_stats" near line 1 > > I queried the data type 1082 references and found it is the "date" data > type. > > # select oid,typowner,typname from pg_type where oid = 1082 ; > oid | typowner | typname > ------+----------+--------- > 1082 | 10 | date > (1 row) > > > The function is simple with the following definition: > > # CREATE FUNCTION ds_stats( date, text) RETURNS integer > LANGUAGE plpgsql > AS $_$ > DECLARE > -- inserts new statistics into doc_stats > -- table calculated from the documents table > -- 1st argument is the published date > -- 2nd argument is the source > pub_date ALIAS FOR $1; > pub_source ALIAS FOR $2; > new_stat documents_statistics%ROWTYPE; > BEGIN > select into new_stat > published, count(*), split_part(filename,'/', 5) > from documents > where published = pub_date and > split_part(filename,'/', 5) = pub_source > group by published, split_part(filename,'/', 5) ; > IF found then > delete from documents_statistics where published = pub_date and > source = pub_source; > > insert into documents_statistics ( published, articles, source ) > values ( new_stat.published, new_stat.articles, new_stat.source ); > return new_stat.articles; > else > delete from documents_statistics where published = pub_date and > source = pub_source; > return 0; > END IF; > > END; > $_$; > > The table documents_statistics has definition: > > CREATE TABLE documents_statistics ( > published date, > articles bigint, > source text > ); > > > I use the function in queries like: > > select ds_stats('2015-08-10'::date, 'wp_news') ; > > > I dropped the function and can now not add it back to the database. Also > doing a simple query on the table filtering on the published field does > not present any problems. I was going to submit this as a bug against > the new 9.5alpha2 release but thought I would run this by this group > before doing so. Any thoughts? > > > > Thanks, > > Stuart > > > > > -- Adrian Klaver adrian.klaver@aklaver.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql