Re: Add schema to the query - Mailing list pgsql-general

From Melvin Davidson
Subject Re: Add schema to the query
Date
Msg-id CANu8Fiyvau8UDN=shQ8kExa2NKe4_qCs1QjvktP6kxiGstWnKQ@mail.gmail.com
Whole thread Raw
In response to Add schema to the query  (Igor Korot <ikorot01@gmail.com>)
Responses Re: Add schema to the query
List pgsql-general


On Sun, May 6, 2018 at 10:19 PM, Igor Korot <ikorot01@gmail.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!

pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Add schema to the query
Next
From: Melvin Davidson
Date:
Subject: Re: Add schema to the query