pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedGet relation name form relids in postgresql
8+ messages / 2 participants
[nested] [flat]
* Get relation name form relids in postgresql
@ 2017-10-05 18:17 Gourav Kumar <gourav1905@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Gourav Kumar @ 2017-10-05 18:17 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 01:42 Rene Romero Benavides <rene.romero.b@gmail.com>
parent: Gourav Kumar <gourav1905@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Rene Romero Benavides @ 2017-10-06 01:42 UTC (permalink / raw)
To: Gourav Kumar <gourav1905@gmail.com>; +Cc: pgsql-sql
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/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 02:48 Gourav Kumar <gourav1905@gmail.com>
parent: Rene Romero Benavides <rene.romero.b@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Gourav Kumar @ 2017-10-06 02:48 UTC (permalink / raw)
To: Rene Romero Benavides <rene.romero.b@gmail.com>; +Cc: pgsql-sql
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/
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 02:54 Rene Romero Benavides <rene.romero.b@gmail.com>
parent: Gourav Kumar <gourav1905@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Rene Romero Benavides @ 2017-10-06 02:54 UTC (permalink / raw)
To: Gourav Kumar <gourav1905@gmail.com>; +Cc: pgsql-sql
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/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 02:55 Gourav Kumar <gourav1905@gmail.com>
parent: Rene Romero Benavides <rene.romero.b@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Gourav Kumar @ 2017-10-06 02:55 UTC (permalink / raw)
To: Rene Romero Benavides <rene.romero.b@gmail.com>; +Cc: pgsql-sql
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/
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 03:00 Rene Romero Benavides <rene.romero.b@gmail.com>
parent: Gourav Kumar <gourav1905@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Rene Romero Benavides @ 2017-10-06 03:00 UTC (permalink / raw)
To: Gourav Kumar <gourav1905@gmail.com>; +Cc: pgsql-sql
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/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 03:04 Gourav Kumar <gourav1905@gmail.com>
parent: Rene Romero Benavides <rene.romero.b@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Gourav Kumar @ 2017-10-06 03:04 UTC (permalink / raw)
To: Rene Romero Benavides <rene.romero.b@gmail.com>; +Cc: pgsql-sql
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/
>
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Get relation name form relids in postgresql
@ 2017-10-06 03:10 Rene Romero Benavides <rene.romero.b@gmail.com>
parent: Gourav Kumar <gourav1905@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Rene Romero Benavides @ 2017-10-06 03:10 UTC (permalink / raw)
To: Gourav Kumar <gourav1905@gmail.com>; +Cc: pgsql-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/
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2017-10-06 03:10 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 18:17 Get relation name form relids in postgresql Gourav Kumar <gourav1905@gmail.com>
2017-10-06 01:42 ` Rene Romero Benavides <rene.romero.b@gmail.com>
2017-10-06 02:48 ` Gourav Kumar <gourav1905@gmail.com>
2017-10-06 02:54 ` Rene Romero Benavides <rene.romero.b@gmail.com>
2017-10-06 02:55 ` Gourav Kumar <gourav1905@gmail.com>
2017-10-06 03:00 ` Rene Romero Benavides <rene.romero.b@gmail.com>
2017-10-06 03:04 ` Gourav Kumar <gourav1905@gmail.com>
2017-10-06 03:10 ` Rene Romero Benavides <rene.romero.b@gmail.com>
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