Is it possible to findout actual owner of table?

Started by dipti shahabout 16 years ago7 messagesgeneral
Jump to latest
#1dipti shah
shahdipti1980@gmail.com

Hi,

I have created the stored procedure that allows particular users to create
the table. I want to prevent users to drop the tables owned by someone esle
and hence, I am making owner of each table created by this stored procedure
to super user(postgres) so that no one will be allowed to drop/alter table.
I want to allow to drop/alter the table by actuall user who ran the stored
procedure to create the table. Could anyone please suggest me how to proceed
with this?

Thanks,
Dipti

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: dipti shah (#1)
Re: Is it possible to findout actual owner of table?

dipti shah <shahdipti1980@gmail.com> writes:

I have created the stored procedure that allows particular users to create
the table. I want to prevent users to drop the tables owned by someone esle
and hence, I am making owner of each table created by this stored procedure
to super user(postgres) so that no one will be allowed to drop/alter table.
I want to allow to drop/alter the table by actuall user who ran the stored
procedure to create the table. Could anyone please suggest me how to proceed
with this?

It sounds like you are going to a great deal of trouble to reinvent the
standard behavior. Why not forget the stored procedure and just let
users create and drop their own tables?

regards, tom lane

#3dipti shah
shahdipti1980@gmail.com
In reply to: Tom Lane (#2)
Re: Is it possible to findout actual owner of table?

I don't want users to create/drop/alter anything directly. They have to use
stored procedure for everything. The stored procedure creates logging tables
and stores many other auditing information so it is madatory to prevent
users from running any direct commands.

Thanks,
Dipti

On Tue, Mar 9, 2010 at 11:54 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

dipti shah <shahdipti1980@gmail.com> writes:

I have created the stored procedure that allows particular users to

create

the table. I want to prevent users to drop the tables owned by someone

esle

and hence, I am making owner of each table created by this stored

procedure

to super user(postgres) so that no one will be allowed to drop/alter

table.

I want to allow to drop/alter the table by actuall user who ran the

stored

procedure to create the table. Could anyone please suggest me how to

proceed

with this?

It sounds like you are going to a great deal of trouble to reinvent the
standard behavior. Why not forget the stored procedure and just let
users create and drop their own tables?

regards, tom lane

#4John R Pierce
pierce@hogranch.com
In reply to: dipti shah (#3)
Re: Is it possible to findout actual owner of table?

dipti shah wrote:

I don't want users to create/drop/alter anything directly. They have
to use stored procedure for everything. The stored procedure creates
logging tables and stores many other auditing information so it is
madatory to prevent users from running any direct commands.

may be you should use middleware instead and not let your users connect
directly to SQL at all.

so, any DDL changes, you'd call the middleware server, it would
authenticate the user, decide whats allowed, maintain your audit trail,
logging, etc. ditto, any operations that require database queries, etc,
would all be done by this middleware.

#5dipti shah
shahdipti1980@gmail.com
In reply to: John R Pierce (#4)
Re: Is it possible to findout actual owner of table?

What is middleware?

Is it similar to stored procedure? That what I have been doing. I have
revoked all permissions from mydb schema from public and have SECURITY
DEFINER enable for stored procedure to allow creating/droping/altering
tables.

Thanks.

On Tue, Mar 9, 2010 at 12:19 PM, John R Pierce <pierce@hogranch.com> wrote:

Show quoted text

dipti shah wrote:

I don't want users to create/drop/alter anything directly. They have to
use stored procedure for everything. The stored procedure creates logging
tables and stores many other auditing information so it is madatory to
prevent users from running any direct commands.

may be you should use middleware instead and not let your users connect
directly to SQL at all.

so, any DDL changes, you'd call the middleware server, it would
authenticate the user, decide whats allowed, maintain your audit trail,
logging, etc. ditto, any operations that require database queries, etc,
would all be done by this middleware.

#6John R Pierce
pierce@hogranch.com
In reply to: dipti shah (#5)
Re: Is it possible to findout actual owner of table?

dipti shah wrote:

What is middleware?

An application server that does all the business logic. your user
software calls the application server to do things, and it in turn
accesses the database. User written software is not alloweed to
directly connecct to the databases at all. Classic example of a
middleware platform Apache Tomcat

#7dipti shah
shahdipti1980@gmail.com
In reply to: John R Pierce (#6)
Re: Is it possible to findout actual owner of table?

Hmm...that would be too much work I think. Ayway, could you point me some
useful link for postgresql middleware?

Thanks.

On Tue, Mar 9, 2010 at 1:13 PM, John R Pierce <pierce@hogranch.com> wrote:

Show quoted text

dipti shah wrote:

What is middleware?

An application server that does all the business logic. your user software
calls the application server to do things, and it in turn accesses the
database. User written software is not alloweed to directly connecct to
the databases at all. Classic example of a middleware platform Apache
Tomcat