Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZR8l0-0003Pu-TA for pgsql-sql@arkaria.postgresql.org; Mon, 17 Aug 2015 00:58:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZR8l0-0004Fc-FF for pgsql-sql@arkaria.postgresql.org; Mon, 17 Aug 2015 00:58:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZR8ky-0004Ag-Dp for pgsql-sql@postgresql.org; Mon, 17 Aug 2015 00:58:32 +0000 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZR8kv-00084x-Pk for pgsql-sql@postgresql.org; Mon, 17 Aug 2015 00:58:30 +0000 Received: by pabyb7 with SMTP id yb7so96166059pab.0 for ; Sun, 16 Aug 2015 17:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=vf6zls+NoBPK1OVyadFJ197XJ1ALPKIgTUjEnBsRW/A=; b=GLcFNCzq3kZ/dXAtSRkrMO0XnBwJTwD3b3+jDrfPPoA6lDsRIreYJpy5JodqUAB6j/ FXoLAHJ2MsgdWnpgBej/L0abAbpOYiyWlvWZ8RJdkYtROvceHQltjkJjejQe4cG4I7m0 wiWhTHWFzdLr+X+c7lyAI7TaPzJzd4guaowMLySuA1dQDg3eomZg2CTY9DGYetwuR17u GdUcY0VXfkfWgLe6qQuuRY2tRg+FjISXhWyS9U0y0U4FGhZG3VpUEsW/PytvQp8Cvi+J aDMDyerESChmiu88hnmnAsNLBrOk7vHxXUOcDCSWdXvQgujLPmBgjBncXrv19o+lBhWS 4GkA== X-Received: by 10.69.2.34 with SMTP id bl2mr111056046pbd.165.1439773108849; Sun, 16 Aug 2015 17:58:28 -0700 (PDT) Received: from station12.ousa.org (nat-198-95-226-236.netapp.com. [198.95.226.236]) by smtp.googlemail.com with ESMTPSA id ea13sm1455049pac.30.2015.08.16.17.58.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Aug 2015 17:58:28 -0700 (PDT) To: "pgsql-sql@postgresql.org" From: Stuart Subject: ERROR: cache lookup failed for type X-Enigmail-Draft-Status: N1110 Message-ID: <55D131B0.6010500@gmail.com> Date: Mon, 17 Aug 2015 04:58:24 +0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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 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. 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 -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql