Re: in the different schema ,the sequence name is same, and a table's column definition use this sequence,so,how can I identify sequence's schema name by system view/table:

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: in the different schema ,the sequence name is same, and a table's column definition use this sequence,so,how can I identify sequence's schema name by system view/table:
Дата
Msg-id CAKFQuwbTyugCotCc5dE-5Njy3MG3ZVgDd2c_J9=fU541dnaOWA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: in the different schema ,the sequence name is same, and a table's column definition use this sequence,so,how can I identify sequence's schema name by system view/table:  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-docs
On Wednesday, October 1, 2025, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wednesday, October 1, 2025, yanliang lei <msdnchina@163.com> wrote:
dbversion180=# create table schema_1.test_tab_100(c1 int default nextval('seq_xx_yy'));

Since you didn’t schema qualify the sequence name every single time a default value is created the sequence will be looked up anew.  The stored expression is not associated with any specific object.

This is also why there is a separate step to mark a sequence as being owned by a table.  That establishes a dependency that this textual form is unable to do.

 
 Ignore that…we do stored the parsed representation which nominally has the schema recorded, it’s just that the text serialization it too “helpful” by inspecting the search_path and only produces the schema prefix if it would be necessary to resolve the reference.

David J.

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