Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hl0Zy-0008BS-9n for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2019 00:35:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hl0Zw-0001CP-4F for pgsql-general@arkaria.postgresql.org; Wed, 10 Jul 2019 00:35:24 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hl0Wl-0006cx-IT for pgsql-general@lists.postgresql.org; Wed, 10 Jul 2019 00:32:08 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hl0Wg-0005CR-Sd for pgsql-general@postgresql.org; Wed, 10 Jul 2019 00:32:06 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 8C829223D5; Tue, 9 Jul 2019 20:31:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 09 Jul 2019 20:31:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=g 5SSwK02yFCPTtUneR7Wr2rLrLPnMlYg6xRaxVTo2GQ=; b=hU0WVFnbaUCJRik3Q 9YFfzf2YnQ4nfZ4CNPdf8TBNnKS7H/y38ithN7yEEuQmTxy6QB4HMj0EhHRUTv8R ld/4Ej2IzH+bUd9WEiTXGplYb2XZm0oENVDxO482AVOOHGASWyPaugfTgeiVbuzY cfFGeqqN38t7t+vcJXD65fJyA/OMttEPtp2EyydGpSL2JdRJ37cOSFhzBYqjDmf9 U+epCdlZLFeKoLy8quXSE+Fn/CCh8pKps3K3CHXh2hnkxnMV3YUGHNOKw9FCB9T9 mT4Ss5dg+syeWWH5V4HUXhhCkxwCklaKLMTDolGQbTF5dwjFK7BBzPVS+n4acFgQ yoYoA== DKIM-Signature: v=1; a=rsa-sha256; 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-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=g5SSwK02yFCPTtUneR7Wr2rLrLPnMlYg6xRaxVTo2 GQ=; b=ktj1dN9pOGpcgI7rwmi2Kq5Jd2V8SfWLQ2oo+lfMb1nf9sbAfDfoaQhsc zi+q0YmNIIt8JdDvGpWUzb24fSWwtyc+Zdv9AmzhGtR7h1/PAfLMtEbG+3MZHFVf rfZIQKV60z2+1jWzr8/pErgK5n+VHUUP0saXaVYfRI7cwFMTfCyFLVbwp4RcGuCw ItEWJfsC5IE1IsmmZOKGjULypVCrInZbOjjM6MU6zfAC4bBKvJlRC3Zkt1xYsGB2 3MD/aC/G9f5xfNMq/ZTSlIYEgyp8ypInvueN0KeGZrgUFxgbJxwTPhkLJGd3+618 84DUffVXwlsCEDKPDyCuiugvoOchw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgeeggdefhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpehluhgtvggvrdhorhhgnecukfhppeejuddrvdduvddrudehtddr vddtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrg hklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 96B2380060; Tue, 9 Jul 2019 20:31:58 -0400 (EDT) Subject: Re: pg_dump and search_path To: "Igal @ Lucee.org" , pgsql-general References: <1f5111a5-e49e-e44a-67df-b367e5d31fdf@lucee.org> <94e28e8c-e5cf-f0b5-a148-43452446d9ec@aklaver.com> <126613fd-e0a9-c79f-a400-028107214439@aklaver.com> <09136454-d905-7cce-d0cd-38158482e269@lucee.org> From: Adrian Klaver Message-ID: <9660facc-0bdd-d7fd-8316-02a45a509dd5@aklaver.com> Date: Tue, 9 Jul 2019 17:31:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <09136454-d905-7cce-d0cd-38158482e269@lucee.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 7/9/19 4:24 PM, Igal @ Lucee.org wrote: > On 7/9/2019 10:45 AM, Adrian Klaver wrote: >> On 7/9/19 7:41 AM, Igal @ Lucee.org wrote: >>> On 7/9/2019 7:02 AM, Adrian Klaver wrote: >>>> On 7/8/19 11:48 PM, Igal @ Lucee.org wrote: >>>>> I have a custom search_path: >>>>> >>>>> # show search_path; >>>>>             search_path >>>>> ---------------------------------- >>>>>   "staging, transient, pg_catalog" >>>>> (1 row) >>>>> >>>>> I ran `pg_dump --schema-only` and the only reference in the output >>>>> to search_path is: >>>>> >>>>>    SELECT pg_catalog.set_config('search_path', '', false); >>>>> >>>>> Then one of my functions which does not reference the full name of >>>>> a table with its schema fails with "relation [rel-name] does not >>>>> exist". >>>> >>>> Where is this failing? >>>> >>>> Do you have the search_path set in the config for the server you are >>>> dumping to? >>> >>> It is failing during the Restore operation.  I can provide more >>> information if I'll understand what you mean exactly by "Where". >> >> Yes, because I cannot replicate with just a function: >> >> CREATE OR REPLACE FUNCTION public.search_path_test(integer) >>  RETURNS integer >>  LANGUAGE plpgsql >> AS $function$ >> BEGIN >>     perform * from test_tbl; >>     RETURN 1; >> END; >> $function$ >> >> test_(postgres)# \d test_tbl >>            Table "test_schema.test_tbl" >>  Column |  Type   | Collation | Nullable | Default >> --------+---------+-----------+----------+--------- >>  id     | integer | >> >> pg_dump -d test -U postgres -x -p 5412 -Fc -f dump_search_path.out >> pg_restore --single-transaction -d test -c -U postgres -p 5412 >> dump_search_path.out >> >> SELECT pg_catalog.set_config('search_path', '', false); >> >> postgres-2019-07-09 10:37:32.488 PDT-604LOG:  statement: CREATE >> FUNCTION public.search_path_test(integer) RETURNS integer >>             LANGUAGE plpgsql >>             AS $$ >>         BEGIN >>             perform * from test_tbl; >>             RETURN 1; >>         END; >>         $$; >> >> >> >> postgres-2019-07-09 10:37:32.489 PDT-604LOG:  statement: ALTER >> FUNCTION public.search_path_test(integer) OWNER TO aklaver; >> >> >> My guess is the function is being used somewhere. > > I see.  Yes, the function is used by an INDEX.  So somewhere down the > line in the pgdump file I have: > >   CREATE INDEX ix_items_tags ON staging.items USING gin > (staging.some_func_returning_array(col1)); Well you are part of the way there, the function is schema qualified:) I will leave it others more knowledgeable on the subject as to whether a function as a GIN expression is a good idea or not. > > Igal > -- Adrian Klaver adrian.klaver@aklaver.com