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 1hkzTn-0005Vd-7z for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 23:24:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkzTk-0000Uk-6H for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 23:24:56 +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 1hkzTj-0000Ud-R8 for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 23:24:55 +0000 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkzTh-0004ZT-7z for pgsql-general@postgresql.org; Tue, 09 Jul 2019 23:24:55 +0000 Received: by mail-ot1-x343.google.com with SMTP id n5so274953otk.1 for ; Tue, 09 Jul 2019 16:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=IY8puMokmIADmOP93N/2+fhavhh2hSlnFPq8InDW2IM=; b=Z7y10vibAVgiznakBPfD7sTYGm/ojJ5d63Lyho0GOxgI5X+5y3bJ6B8PLWetRQ7iuC ZIznyhY6cBtXgzxyuLtF1xzI06RFxE4OkK3ifU4REF7O/MJogsgG5JHG/gjJsx2m0RY6 h34I7vKLp1cP+OxYCjYoOl9VHUGgJ/awKylh2Z+Q9y2L6MtV/a6rnTijKn2IyWKyR7vm Nh/my72EwCtdtzA9G0iQqqUVnh1ziE22yACsAd6i9XcmPZJ5nl6IDbhqjYgYwE9lN6+G EPsN+zZNLYZzpFEareYNDdNoNAMpcgLZWgg23VPpwb0I+nernwlq1o3DfL7U2HQSCP6j PUpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=IY8puMokmIADmOP93N/2+fhavhh2hSlnFPq8InDW2IM=; b=I1vNyEQS0kWulf49PmiYHriI2NsTUKTNpieHgWza4gClZ600m6sziS9jKDEOQsAYVp AZLld560nIJCup7DqQfQgFUSJ07lzY4p+VZxVfHS1jz4MPSsM4cPnVBmWmIVYcMwpoov 7oTxxY6PH2BSjSC839QrhiYYCyNMr1c857EbuxcwAdCcmwI2xSN8UmN1lEjjnJUMoUhI iuUQiCuAQyADBLEZpuW7rqTv131sEcdlgipWb225bmTeZNupdn8qkeVxASzz63TxWBGs 5jqngBvJM1NQx/sp/Jp/h/MkF1C5HlM2L5rwXtvind864sn6sNJUdTcw1eWQTDEdpyxb 7oig== X-Gm-Message-State: APjAAAXT19cgVonxzP5PUnD17aSVlOU/WX6L3yNmQvIMEY08+hoeq7l7 WOjKV6LseuHWIMFnGDa5aQtcDo7E9HB7PQ== X-Google-Smtp-Source: APXvYqy6UGPGLmzZkHe5LTypod4tOnUakhbuiEdmhtsmOfKu/Gdtz52pMXW0pu0nZn5OL9YBZV0tyA== X-Received: by 2002:a9d:458f:: with SMTP id x15mr5953170ote.314.1562714691008; Tue, 09 Jul 2019 16:24:51 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:85a1:bc53:ab51:98bd? ([2600:1700:4000:8120:85a1:bc53:ab51:98bd]) by smtp.googlemail.com with ESMTPSA id d200sm176863oih.26.2019.07.09.16.24.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 16:24:50 -0700 (PDT) Subject: Re: pg_dump and search_path To: Adrian Klaver , pgsql-general References: <1f5111a5-e49e-e44a-67df-b367e5d31fdf@lucee.org> <94e28e8c-e5cf-f0b5-a148-43452446d9ec@aklaver.com> <126613fd-e0a9-c79f-a400-028107214439@aklaver.com> From: "Igal @ Lucee.org" Message-ID: <09136454-d905-7cce-d0cd-38158482e269@lucee.org> Date: Tue, 9 Jul 2019 16:24:47 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <126613fd-e0a9-c79f-a400-028107214439@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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)); Igal