Re: How to choose table in SELECT clause without schema qualifier or 'set local'

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How to choose table in SELECT clause without schema qualifier or 'set local'
Дата
Msg-id CAKFQuwbpYt=P2RudjAs_ZMUHZEO9PWrVcBhX9bR7GRUvTHPu+Q@mail.gmail.com
обсуждение исходный текст
Ответ на How to choose table in SELECT clause without schema qualifier or 'set local'  (intmail01 <intmail01@gmail.com>)
Список pgsql-sql
On Friday, March 22, 2024, intmail01 <intmail01@gmail.com> wrote:
Hi,

My db have many schemas (company name) and there are SELECT code related to tables that I distribute for each company users.

The structure inside are the same for all schemas.

It is a nightmare to change code each time to modify the schema qualifier or SET LOCAL search_path when I add a new company.
Is there command, configurations or any trick to not modify code each time I add company then code can works for any schema.


Do multi-tenant via partitioning and a tenant_id column instead of by schema.

Otherwise, maybe attach a custom search_path value to the logon user each company uses?  See “alter role … set”.  But it is search_path you need to be using.

David J.

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

Предыдущее
От: Jamie Thompson
Дата:
Сообщение: UPDATE with AND clarification
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: UPDATE with AND clarification