Re: Grant select on view - Mailing list pgsql-novice

From thiemo
Subject Re: Grant select on view
Date
Msg-id A147FE42-4549-11D6-BA58-000A27D62F9E@gmx.ch
Whole thread Raw
In response to Re: Grant select on view  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Grant select on view
List pgsql-novice
<excerpt>A complete example; we can't possibly guess what you did
wrong with

only such sketchy details.  It would also be useful to know which

version of PG you are using.

</excerpt>

Oh, sure. A self-compiled 7.2, without any source code modifications.
I first instal a sequence:

"CREATE SEQUENCE seq

  INCREMENT 1

  MINVALUE 1

  START 1

  CACHE 1"

then a table:

"CREATE TABLE base (

att1 type(x) default nextval(seq),

...

attn type(x)

)"

a view:

"CREATE VIEW vie AS

  SELECT att2, ..., attn_1

  FROM base

  WHERE attn = CURRENT_USER::varchar"

a user:

"CREATE USER usr PASSWORD 'somewhat'

  NOCREATEDB

  NOCREATEUSER"

and finally the grant:

"GRANT SELECT ON vie TO usr"


Hope this helps. Thx


Thiemo

<fontfamily><param>Helvetica</param>

--

Thiemo Kellner

Tösstalstrasse 146

CH-8400 Winterthur

</fontfamily>> A complete example; we can't possibly guess what you did wrong with
> only such sketchy details.  It would also be useful to know which
> version of PG you are using.

Oh, sure. A self-compiled 7.2, without any source code modifications. I
first instal a sequence:
"CREATE SEQUENCE seq
   INCREMENT 1
   MINVALUE 1
   START 1
   CACHE 1"
then a table:
"CREATE TABLE base (
att1 type(x) default nextval(seq),
...
attn type(x)
)"
a view:
"CREATE VIEW vie AS
   SELECT att2, ..., attn_1
   FROM base
   WHERE attn = CURRENT_USER::varchar"
a user:
"CREATE USER usr PASSWORD 'somewhat'
   NOCREATEDB
   NOCREATEUSER"
and finally the grant:
"GRANT SELECT ON vie TO usr"

Hope this helps. Thx

Thiemo

--
Thiemo Kellner
Tösstalstrasse 146
CH-8400 Winterthur

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Grant select on view
Next
From: Tom Lane
Date:
Subject: Re: Grant select on view