Is PUBLIC a schema, role or user in Vertica?

Moderator: NorbertKrupa

Post Reply
sarah
Intermediate
Intermediate
Posts: 77
Joined: Mon Aug 27, 2012 1:34 pm

Is PUBLIC a schema, role or user in Vertica?

Post by sarah » Tue Oct 22, 2013 2:34 pm

Hi all,

In the Admin Guide it has this info:
PUBLIC role
By default, every database has the special PUBLIC role. HP Vertica grants this role to each user automatically, and it is automatically enabled. You grant privileges to this role that every user should have by default. You can also grant access to roles to PUBLIC, which allows any user to access the role using the SET ROLE statement.
Note: The PUBLIC role can never be dropped, nor can it be revoked from users or roles.

PUBLIC user
All non-DBA (superuser) or object owners are PUBLIC users.
Note: Object owners are PUBLIC users for objects that other users own.

Schemas
The PUBLIC schema is present in any newly-created HP Vertica database, and newly-created users have only USAGE privilege on PUBLIC. A database superuser must explicitly grant new users CREATE privileges, as well as grant them individual object privileges so the new users can create or look up objects in the PUBLIC schema.
So which is it? All of them?

I don't think it is a user:

Code: Select all

dbadmin=> select user_name from users where user_name = 'public';
 user_name
-----------
(0 rows)
But it does appear to be a role and a schema:

Code: Select all

dbadmin=> select * from roles where name = 'public';
      role_id      |  name  | assigned_roles
-------------------+--------+----------------
 45035996273704964 | public |
(1 row)

Code: Select all

dbadmin=> \dn public
      List of schemas
  Name  |  Owner  | Comment
--------+---------+---------
 public | dbadmin |
(1 row)
Have a GREAT day!

User avatar
nnani
Master
Master
Posts: 302
Joined: Fri Apr 13, 2012 6:28 am
Contact:

Re: Is PUBLIC a schema, role or user in Vertica?

Post by nnani » Wed Oct 23, 2013 8:06 am

#sarah

Public User - It can just be said a s a category of users in Vertica, So every user except the superuser / DBA lies into this category of Public user.

Public Role - Public role is a default role in Vertica which comes auto generated when your create a new database.
So every a database has this Role auto generated. The role is automatically granted to each user connected to database.This role can be granted privileges and this will work for any connected user to that database.
So for example - Lets say superuser created a database db1 and granted select access to role public on this database. Now sarah user gets connected to database db1 and tries to select some data, this should work fine as the role public is granted to sarah user automatically and the role has a select access on the database.

Public Schema- Like public role, Public schema is also created with every newly created database in Vertica. Public role has a default USAGE privilege on the Public schema in every database.

Hope this helps.. :)
nnani........
Long way to go

You can check out my blogs at vertica-howto

Post Reply

Return to “New to Vertica Database Administration”