Not possible to compare regrole in a view query?

From: Glen Huang <heyhgl(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Not possible to compare regrole in a view query?
Date: 2017-09-05 06:53:11
Message-ID: E919872C-26DB-4915-BB58-402C25F59A3E@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have this simple view definition:

CREATE TEMP VIEW user_schema AS
SELECT nspname AS name FROM pg_namespace
WHERE nspname = 'public' OR nspowner = ‘rolename'::regrole;

But it fails to create the view by complaining: constant of the type "regrole" cannot be used here

If I run the query directly, I get the correct result.

Does that mean I can’t compare role name this way in view? Should I use join to work around it?

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Milen Blagojevic 2017-09-05 08:56:37 CREATE TABLE LIKE including all not including storage parameters?
Previous Message Nico Williams 2017-09-05 05:25:54 Re: Create Action for psql when NOTIFY Recieved