Received: from cobain.rowan.edu (cobain.rowan.edu [150.250.64.40]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0SKNbq95544 for ; Sun, 28 Jan 2001 15:23:37 -0500 (EST) (envelope-from gree3776@rowan.edu) Received: (from root@localhost) by cobain.rowan.edu (8.9.3/8.9.3) id PAA31239 for pgsql-admin@postgresql.org; Sun, 28 Jan 2001 15:23:35 -0500 Received: from groupwise.rowan.edu (groupwise.rowan.edu [150.250.64.17]) by cobain.rowan.edu (8.9.3/8.9.3) with SMTP id PAA31203 for ; Sun, 28 Jan 2001 15:23:31 -0500 Received: from ROWANDOM-Message_Server by groupwise.rowan.edu with Novell_GroupWise; Sun, 28 Jan 2001 15:23:27 -0500 Message-Id: X-Mailer: Novell GroupWise Internet Agent 5.5.2.1 Date: Sun, 28 Jan 2001 15:23:03 -0500 From: "Samuel Greenfeld" To: "<" Subject: Controlling user table creation Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline X-Virus-Scanned: by AMaViS perl-10 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.postgresql.org id f0SKNbq95545 X-Archive-Number: 200101/197 X-Sequence-Number: 574 ( I know this is slightly OT, but since I am not a highly active SQL developer, please bear with me.) Watching this list, I have noticed several people mutter about the fact that any user with access to a database can create a table in it. I do not know if this would work, but I would like to propose a possible workaround. Use this information at your own risk; I do not know if this would work, cause more damage than good, etc. While I am no means an SQL wizard, one of the things I know postgres supports is the ability to create rules. At least under 7.0.2, it seems that rules can be applied to a system table, such as pg_tables. Now, I don't know if SQL rules can do things a user normally could not do. But given that I could create a rule on a pg_tables, one wonders if such a rule could be used to keep users from making tables. The rule would go something like this (more pseudo-code than SQL code): ON INSERT pg_tables WHERE (current_user not a superuser) AND (current_user not in allowed_tablecreator_list) DO DROP (last_table added to pg_tables); This might not exactly work, as pg_tables might not be the last thing to know about a table being added. This also might not work if the rule is executed before pg_tables gets modified, or if rules can not modify system tables (I only tried a "DO NOTHING"). If a rule is the first thing that learns about a table operation, DO INSTEAD NOTHING might work, even in the case where a user can not modify the system tables. Historically, I have not used rules with any of my SQL databases, so I do not know if this would work. But any insight as to what can/can not be done in this area would be useful. Sincerely, Samuel Greenfeld