Re: Add schema to the query

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Add schema to the query
Date: 2018-05-07 04:02:11
Message-ID: CA+FnnTxgWKbRPVBZ4gYgbmk-XyjMQWfGDuz7kOh2+ZaJvC+iag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, Melvin,

On Sun, May 6, 2018 at 9:37 PM, Melvin Davidson <melvin6925(at)gmail(dot)com> wrote:
>
>
> On Sun, May 6, 2018 at 10:33 PM, Melvin Davidson <melvin6925(at)gmail(dot)com>
> wrote:
>>
>>
>>
>> On Sun, May 6, 2018 at 10:19 PM, Igor Korot <ikorot01(at)gmail(dot)com> 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!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2018-05-07 04:54:42 Re: Add schema to the query
Previous Message David G. Johnston 2018-05-07 03:47:23 Re: psycopg2.DataError: invalid input syntax for integer: ""