| From: | Igor Korot <ikorot01(at)gmail(dot)com> |
|---|---|
| To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Connecting pg_attribute with pg_namespace |
| Date: | 2026-11-01 06:01:18 |
| Message-ID: | CA+FnnTzXRVRhuZfSr1e9FHdMiFmvFZo8Ve0W53wRXr4pKZ=9Fg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Sat, Oct 31, 2026 at 4:43 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
> On 10/31/26 3:04 PM, Igor Korot wrote:
> > Hi, Ron,
> >
> > On Sat, Oct 31, 2026 at 1:24 AM Ron Johnson <ronljohnsonjr(at)gmail(dot)com> wrote:
> >>
> >> Join pg_attribute.attrelid to pg_class.oid and thus you have the table's relnamespace value.
> >
> > From the docs:
> >
> > [quote]
> > relnamespace oid (references pg_namespace.oid)
> >
> > The OID of the namespace that contains this relation
> > [/quote]
> >
> > I have a schema name as a string.
> >
> > Should I cast that value to something when I write
> > "pg_class.relnamespace = 'public'"?
>
> Take a look at this link below:
>
> https://www.postgresql.org/docs/current/datatype-oid.html
>
> It will make your like easier.
>
> So:
>
> select relname from pg_catalog.pg_class where relname = 'cell_per' and
> relnamespace = 'public'::regnamespace;
>
> relname
> ----------
> cell_per
>
Thx.
> >
> > Thank you.
> >
> >>
> >> On Sat, Oct 31, 2026 at 1:34 AM Igor Korot <ikorot01(at)gmail(dot)com> wrote:
> >>>
> >>> Hi,
> >>> How do I add schema name to
> >>>
> >>> [code]
> >>> SELECT attnum FROM pg_attribute WHERE attrelid = 'my_table_name';
> >>> [/code]
> >>>
> >>> Thank you.
> >>>
> >>>
> >>
> >>
> >> --
> >> Death to <Redacted>, and butter sauce.
> >> Don't boil me, I'm still alive.
> >> <Redacted> lobster!
> >
> >
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2026-11-01 07:02:45 | Re: Return trimmed string from the query |
| Previous Message | Igor Korot | 2026-10-31 22:04:39 | Re: Connecting pg_attribute with pg_namespace |