pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igal @ Lucee.org <igal@lucee.org>
To: Adrian Klaver <adrian.klaver@aklaver.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: pg_dump and search_path
Date: Tue, 9 Jul 2019 16:24:47 -0700
Message-ID: <09136454-d905-7cce-d0cd-38158482e269@lucee.org> (raw)
In-Reply-To: <126613fd-e0a9-c79f-a400-028107214439@aklaver.com>
References: <1f5111a5-e49e-e44a-67df-b367e5d31fdf@lucee.org>
	<94e28e8c-e5cf-f0b5-a148-43452446d9ec@aklaver.com>
	<fbe59d2f-79ce-1b8e-c96a-ef665f18f747@lucee.org>
	<126613fd-e0a9-c79f-a400-028107214439@aklaver.com>

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





view thread (17+ messages)  latest in thread

Message-ID: <09136454-d905-7cce-d0cd-38158482e269@lucee.org>
Permalink:  ../09136454-d905-7cce-d0cd-38158482e269@lucee.org/
Also on:    postgresql.org/message-id/09136454-d905-7cce-d0cd-38158482e269@lucee.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: igal@lucee.org, adrian.klaver@aklaver.com
  Subject: Re: pg_dump and search_path
  In-Reply-To: <09136454-d905-7cce-d0cd-38158482e269@lucee.org>
  References: <1f5111a5-e49e-e44a-67df-b367e5d31fdf@lucee.org> <94e28e8c-e5cf-f0b5-a148-43452446d9ec@aklaver.com> <fbe59d2f-79ce-1b8e-c96a-ef665f18f747@lucee.org> <126613fd-e0a9-c79f-a400-028107214439@aklaver.com> <09136454-d905-7cce-d0cd-38158482e269@lucee.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox