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:

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: yanliang lei <msdnchina(at)163(dot)com>
Cc: "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: 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:
Date: 2025-10-01 11:07:57
Message-ID: CAKAnmmK5VkXQge6iCn4QDvnmBRrnrxcw0LLoLw3EPTpHgoPWDw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Wed, Oct 1, 2025 at 6:04 AM yanliang lei <msdnchina(at)163(dot)com> wrote:

> the column c1 in the schema_1.test_tab_100 is associated with which
> sequence ?? *schema_1*.seq_xx_yy or *public*.seq_xx_yy??
>

This is better asked on the pgsql-general mailing list, but the short
answer is that you have to look at your search_path as well. Since you just
created schema_1, and public is in your search_path, a plain seq_xx_yy is
the one from the public schema. To see the fully-qualified name, run:

SET search_path = pg_catalog;

before issuing your select from information_schema.columns

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message David G. Johnston 2025-10-01 12:20:34 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:
Previous Message yanliang lei 2025-10-01 10:04:09 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: