Re: schema diff tool problem with owner statements

Поиск
Список
Период
Сортировка
От Akshay Joshi
Тема Re: schema diff tool problem with owner statements
Дата
Msg-id CANxoLDfZC_qb_OVGt7zwdBLJ7=zs2r9czCS7QRcL4fDFjMGkRQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: schema diff tool problem with owner statements  (postgresql@yawebhost.com)
Список pgadmin-support
Hi

On Fri, Nov 12, 2021 at 8:47 PM <postgresql@yawebhost.com> wrote:

Thanks for the reply, comment embedded below:

On 11/11/21 11:58 PM, Akshay Joshi wrote:
Hi 

On Fri, Nov 12, 2021 at 12:45 AM <postgresql@yawebhost.com> wrote:
I'm trying to compare 2 schemas (devschema is the source and testschema
is the target) and generate a script that can be run on the target that
will create the missing tables.  I ran the schema diff, and it generated
items like this:

CREATE TABLE IF NOT EXISTS tablename
(
fields, etc
)
TABLESPACE pg_default;

ALTER TABLE IF EXISTS public.tablename
     OWNER to devschema;


When I run the script on testschema, I don't want it trying to alter the
owner of the table because that statement will fail anyway.

I found a setting in "preferences" called "ignore owner", and set it to
true (If set to True, then the Schema Diff tool ignores the owner while
comparing the objects.)

However, this setting has no effect.  The alter table statements still
get generated, and I am left to remove them manually.

If there is something I'm doing wrong please let me now.  I swear this
setting worked many months ago when I used this tool, but it seems to
not be working now.

Version 6.1 (downloaded and updated today)

    This is by design, as at the time of comparison or generating the script we can't check the owner is exist on the target schema or not. Consider the case where the owner exists and the user wants to run the same DDL statement. I think the user needs to manually change the ow
ner. There is a find and replace option in the query tool by which we can easily replace. 

Maybe I'm missing something (I don't know a lot about postgres internals, all I want is to copy tables over).  That setting in the preferences SEEMS to be what I need here.  I'd simply like the diff tool to ignore the differences in the owner, and not generate the "ALTER TABLE IF EXISTS public.tablename  OWNER to devschema;" statement.  My script will run fine on the target if I delete all those alter table statements, and it will also run fine if I search and replace 'devschema' with 'testschema', but I'd rather not have to do either of those.  Isn't this a common use case when the user wants to get 2 schemas "in sync" but they don't care about the fact that the owner of the objects on the source and target is different..?


    I understood the scenario, but the most common use case that I have seen is to make 2 schemas "in sync" with the appropriate owner. In such a case, users will have to write the complete ALTER statement for each object which is more time-consuming (find all the create statements and write ALTER..) then find and replace. 

    I'll suggest you create a new feature request https://redmine.postgresql.org/projects/pgadmin4/issues/new will check the feasibility.


Thank you,

Wes





--
Thanks & Regards
Akshay Joshi
pgAdmin Hacker | Principal Software Architect
EDB Postgres
Mobile: +91 976-788-8246



--
Thanks & Regards
Akshay Joshi
pgAdmin Hacker | Principal Software Architect
EDB Postgres
Mobile: +91 976-788-8246

В списке pgadmin-support по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: pgadmin4 for fedora 35
Следующее
От: Akshay Joshi
Дата:
Сообщение: pgAdmin 4 v6.2 Released