Re: Add schema to the query

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: Add schema to the query
Дата
Msg-id CANu8Fiw-hM-txx7rxc5T34nxVXtO1vx_LYodwbekn61-+TaWQg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Add schema to the query  (Melvin Davidson <melvin6925@gmail.com>)
Ответы Re: Add schema to the query  (Igor Korot <ikorot01@gmail.com>)
Список pgsql-general


On Sun, May 6, 2018 at 10:33 PM, Melvin Davidson <melvin6925@gmail.com> wrote:


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!

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'


--
Melvin Davidson
Maj. Database & Exploration Specialist

Universe Exploration Command – UXC

Employment by invitation only!

В списке pgsql-general по дате отправления:

Предыдущее
От: Melvin Davidson
Дата:
Сообщение: Re: Add schema to the query
Следующее
От: tango ward
Дата:
Сообщение: psycopg2.DataError: invalid input syntax for integer: ""