Search Postgresql Archives

Re: Add schema to the query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Melvin,

On Sun, May 6, 2018 at 9:37 PM, Melvin Davidson <melvin6925@xxxxxxxxx> wrote:
>
>
> On Sun, May 6, 2018 at 10:33 PM, Melvin Davidson <melvin6925@xxxxxxxxx>
> wrote:
>>
>>
>>
>> On Sun, May 6, 2018 at 10:19 PM, Igor Korot <ikorot01@xxxxxxxxx> wrote:
>>>
>>> Hi, ALL,
>>>
>>> Is there an easy way to add the schema to the following query:
>>>
>>> SELECT u.usename FROM pg_class c, pg_user u WHERE u.usesysid =
>>> c.relowner AND relname = ?
>>>
>>> Thank you.
>>>
>>
>> >Is there an easy way to add the schema to the following query:
>>
>> You mean like this?
>> SELECT u.usename,
>>                n.nspname AS schema
>>   FROM pg_class c
>>     JOIN pg_namespace n ON n.oid = c.relnamespace,
>>        pg_user u
>>  WHERE u.usesysid = c.relowner
>>    AND relname = ?
>>
>>
>> --
>> Melvin Davidson
>> Maj. Database & Exploration Specialist
>> Universe Exploration Command – UXC
>> Employment by invitation only!
>
>
> OR do you mean like this?
> SELECT u.usename
>   FROM pg_class c
>     JOIN pg_namespace n ON n.oid = c.relnamespace,
>        pg_user u
>  WHERE u.usesysid = c.relowner
>    AND relname = ?
>    AND n.nspname = 'public'

Sorry needed to filter on the schema + table.

So, thank you.

>
>
> --
> Melvin Davidson
> Maj. Database & Exploration Specialist
> Universe Exploration Command – UXC
> Employment by invitation only!





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux