pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Rene Romero Benavides <rene.romero.b@gmail.com>
To: Gourav Kumar <gourav1905@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Get relation name form relids in postgresql
Date: Thu, 5 Oct 2017 22:10:50 -0500
Message-ID: <CANaGW09KM=uhtK7tUezEfYe7r5bUGFpgc8FJvFuJbvZ6Qs-T_g@mail.gmail.com> (raw)
In-Reply-To: <CAPzqDmhbxAW_+-Murrj5_6HzMjx3gQF1ef4ERXHgcoduij1qTA@mail.gmail.com>
References: <CAPzqDmiqOjxQWoxV4iqNmvs7Uj9e8eUc8xTOqvmMJzsprDvOpA@mail.gmail.com>
<CANaGW08RWos2hiwQAwCThtWV4yUe2Bt+VQ2+s-3LQyM9=o-yhg@mail.gmail.com>
<CAPzqDmg=yyO3oki2Qm4HBRYjHy=rR8EXChkLX-LSYf-jKN+U1g@mail.gmail.com>
<CANaGW0-m04cL2yP4uo6J4zLW+BXx4B5T0OuHBxNOH1UhiizXrQ@mail.gmail.com>
<CAPzqDmjBDFhUfQAfYwFKkwwjjvWOMPRRTjtOO44645ZWMNsRHg@mail.gmail.com>
<CANaGW0_9uxQK+KXjdvkYoSfjCM4ZF9GJPVZPDc0ibd1CJu1SYg@mail.gmail.com>
<CAPzqDmhbxAW_+-Murrj5_6HzMjx3gQF1ef4ERXHgcoduij1qTA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Mmm, what do you mean by postgres code ? Are we talking here about the
postgres source code or SQL ? If it's the source code, that's beyond my
knowledge, sorry. The pgsql-hackers list may be a better fit for what
you're looking for, or perhaps pgsql-general
Best.
.
2017-10-05 22:04 GMT-05:00 Gourav Kumar <gourav1905@gmail.com>:
> But I can't fire a query when I am inside postgres code, while executing
> another query.
> On 06-Oct-2017 8:31 AM, "Rene Romero Benavides" <rene.romero.b@gmail.com>
> wrote:
>
>> Sure, if you cast a field that contains a relid to the reglass type, you
>> get the name of the relation.
>>
>> Example:
>> select relid, relid::regclass from pg_stat_user_tables where relname =
>> 'theNameOfYourTable';
>>
>>
>> 2017-10-05 21:55 GMT-05:00 Gourav Kumar <gourav1905@gmail.com>:
>>
>>> I did not get this part. Can you elaborate please.
>>> On 06-Oct-2017 8:24 AM, "Rene Romero Benavides" <rene.romero.b@gmail.com>
>>> wrote:
>>>
>>>> Sure, you can cast the relid to regclass, or join the mentioned table.
>>>>
>>>>
>>>> 2017-10-05 21:48 GMT-05:00 Gourav Kumar <gourav1905@gmail.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> Thanks for the reply.
>>>>>
>>>>> I want to be able to do that from inside the postgres code, while I am
>>>>> in middle of executing a Query.
>>>>> On 06-Oct-2017 7:12 AM, "Rene Romero Benavides" <
>>>>> rene.romero.b@gmail.com> wrote:
>>>>>
>>>>>> Hi. Try pg_catalog.pg_stat_user_tables, there you have the relid
>>>>>> (oid) identifier
>>>>>>
>>>>>> 2017-10-05 13:17 GMT-05:00 Gourav Kumar <gourav1905@gmail.com>:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I am looking for a way to get the relation name from the relid or
>>>>>>> RelOptInfo data structure. Can anyone help me with this ? How can I use
>>>>>>> these to get to relation name ?
>>>>>>>
>>>>>>> --
>>>>>>> Thanks,
>>>>>>> Gourav Kumar
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> El genio es 1% inspiración y 99% transpiración.
>>>>>> Thomas Alva Edison
>>>>>> http://pglearn.blogspot.mx/
>>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>> El genio es 1% inspiración y 99% transpiración.
>>>> Thomas Alva Edison
>>>> http://pglearn.blogspot.mx/
>>>>
>>>>
>>
>>
>> --
>> El genio es 1% inspiración y 99% transpiración.
>> Thomas Alva Edison
>> http://pglearn.blogspot.mx/
>>
>>
--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/
view thread (8+ messages)
Message-ID: <CANaGW09KM=uhtK7tUezEfYe7r5bUGFpgc8FJvFuJbvZ6Qs-T_g@mail.gmail.com>
Permalink: ../CANaGW09KM=uhtK7tUezEfYe7r5bUGFpgc8FJvFuJbvZ6Qs-T_g@mail.gmail.com/
Also on: postgresql.org/message-id/CANaGW09KM=uhtK7tUezEfYe7r5bUGFpgc8FJvFuJbvZ6Qs-T_g@mail.gmail.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rene.romero.b@gmail.com, gourav1905@gmail.com
Subject: Re: Get relation name form relids in postgresql
In-Reply-To: <CANaGW09KM=uhtK7tUezEfYe7r5bUGFpgc8FJvFuJbvZ6Qs-T_g@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox