Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 7D4821CC0234 for ; Tue, 29 May 2012 23:14:14 -0300 (ADT) Received: from mail-pb0-f46.google.com ([209.85.160.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SZYQO-0003En-Tm for pgsql-bugs@postgresql.org; Wed, 30 May 2012 02:14:13 +0000 Received: by pbbrp8 with SMTP id rp8so6772935pbb.19 for ; Tue, 29 May 2012 19:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=HznRKJ0/7lHwzcrqc7nFa93+RWzsOiBZI+fytkfMfHE=; b=m1+B27ONjqnB7DUalsDixvqjdVEah8SXRgCQSLvU7AS5X9KiM9XaTAWmboNyen1V06 rPga9Y0rmlY4Uv0Z1n+TUckzKGOV3YIF9JTmfjH3M19zG03zUl+47+8jam++2FvojhP9 3MpxyKgKhdAqnJJeyIRUjEEO/xA1/zkcv26LGiT5lmG/5PdD4LkJ9uKB0zuRcMUFpHVI BqeZb+YxSSs/VH4ceOW4msTkINsZeEoa/oVfOJI6kJaRXKkQxcWdDBSAf6LelZBv3C5z csUbEPeWa5NQFftnWRLaDB/I9Ji1BI3idqbzYqvYVZMFcwBjdeNCkTpEkSl5xfihxYCf EVLA== Received: by 10.68.201.73 with SMTP id jy9mr43228221pbc.19.1338344040105; Tue, 29 May 2012 19:14:00 -0700 (PDT) Received: from [192.168.0.3] (c-24-17-164-54.hsd1.wa.comcast.net. [24.17.164.54]) by mx.google.com with ESMTPS id ru4sm24691263pbc.66.2012.05.29.19.13.58 (version=SSLv3 cipher=OTHER); Tue, 29 May 2012 19:13:59 -0700 (PDT) Message-ID: <4FC58244.9060801@gmail.com> Date: Tue, 29 May 2012 19:13:24 -0700 From: Adrian Klaver User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Bruce Momjian CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6666: pg_upgrade 9.2beta1 plpython/plpython2 References: <20120527022416.GA20260@momjian.us> <4FC2773B.6050206@gmail.com> <20120530004407.GL20260@momjian.us> In-Reply-To: <20120530004407.GL20260@momjian.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201205/221 X-Sequence-Number: 33192 On 05/29/2012 05:44 PM, Bruce Momjian wrote: > On Sun, May 27, 2012 at 11:49:31AM -0700, Adrian Klaver wrote: >>> >>> If you can help me find out how these got defined this way, I might be >>> able to prevent this problem for the next person. >>> >> >> After reading the above thread here is what the queries mentioned return: >> >> production=# SELECT nspname,proname,probin FROM pg_proc,pg_namespace >> WHERE probin LIKE '%python%' and pg_proc.pronamespace=pg_namespace.oid; >> >> nspname | proname | probin >> ------------+-------------------------+------------------ >> pg_catalog | plpython_call_handler | $libdir/plpython >> pg_catalog | plpython_inline_handler | $libdir/plpython >> public | plpython_call_handler | $libdir/plpython >> (3 rows) > > You are the third person to have this problem, and this was the > information I needed to properly find the cause. I believe it was done > in this 8.1 commit: > > e0dedd0559f005d60c69c9772163e69c204bac69 > > Implement a preliminary 'template' facility for procedural languages, > as per my recent proposal. For now the template data is hard-wired > in proclang.c --- this should be replaced later by a new shared > system catalog, but we don't want to force initdb during 8.1 beta. > This change lets us cleanly load existing dump files even if they > contain outright wrong information about a PL's support functions, such > as a wrong path to the shared library or a missing validator function. > Also, we can revert the recent kluges to make pg_dump dump PL support > functions that are stored in pg_catalog. While at it, I removed the > code in pg_regress that replaced $libdir with a hardcoded path for > temporary installations. This is no longer needed given our support > for relocatable installations. > > This moved the helper functions into pg_catalog, but the author probably > didn't realize that public schema helper functions would continue to be > dumped by pg_dump. These helper functions continued to be > dumped/restored until the rename. There are certainly helper functions > for other languages that are still duplicated in the public schema --- > there is nothing unique about plpython. We are only seeing problems > because of the plpython.so rename. Yes, I had the same layout for plpgsql. Already got rid of the public entry. > > In normal use, a pg_dumpall restore would throw an error about a missing > helper function shared objects, but the pg_catalog entry would continue > to work just fine. Odd we have not heard complaints from users seeing > that error on restore --- odds are, they are just ignoring the error, > which pg_upgrade does not do. > > The attached pg_upgrade patch adds checks for this plpython helper > function and reports a proper error, suggesting how to fix the problem: > > Performing Consistency Checks > ----------------------------- > Checking current, bin, and data directories ok > Checking cluster versions ok > > The old cluster has a "plpython_call_handler" function defined > in the "public" schema which is a duplicate of the one defined > in the "pg_catalog" schema. You can confirm this by executing > in psql: > > \df *.plpython_call_handler > > The "public" schema version of this function was created by a > pre-8.1 install of plpython, and must be removed for pg_upgrade > to complete because it references a now-obsolete "plpython" > shared object file. You can remove the "public" schema version > of this function by running the following command: > > DROP FUNCTION public.plpython_call_handler() > > in each affected database: > > test > test3 > > Remove the problem functions from the old cluster to continue. > Failure, exiting Thanks. > > We could do the same for other PL languages if they are ever renamed. I > suppose we don't care about fixing the duplicate schema entries. Not sure what duplicate entries you are referring to. The two pg_catalog entries refer to different handlers, the call handler and the inline handler. > -- Adrian Klaver adrian.klaver@gmail.com