Re: Row-level security?



lawpoop wrote:

On May 28, 7:58 pm, Bob Badour <bbad...@xxxxxxxxxxxxxxxx> wrote:

lawpoop wrote:

On May 28, 4:00 pm, lawpoop <lawp...@xxxxxxxxx> wrote:

I don't think it does. The manual says that, for creating views, "The
SELECT statement cannot refer to system or user variables. "http://dev.mysql.com/doc/refman/5.0/en/create-view.html

I just tried it, and I got the error, "View's SELECT contains a
variable or parameter"

Without seeing the exact query, it's hard to say what's wrong.

One can create views that reference the user() function in mysql 5.0

So, USER() returns something like username@xxxxxxxxxxxxx

What one would need to do, then, is create a table of user permissions
that has a column of the MySQL username and the client_id, or whatever
column you would want to use in restricting on the query. Then create
a view that in some place references a join to that table, and puts
WHERE username = USER() or whatever in the view's where clause.

Correct?

This assumes you connect to the dbms with a different user name for each client. Do you do that?
.



Relevant Pages

  • Re: Row-level security?
    ... SELECT statement cannot refer to system or user variables. ... Without seeing the exact query, it's hard to say what's wrong. ... One can create views that reference the userfunction in mysql 5.0 ... that has a column of the MySQL username and the client_id, ...
    (comp.databases.theory)
  • Re: Row-level security?
    ... SELECT statement cannot refer to system or user variables. ... One can create views that reference the userfunction in mysql 5.0 ...
    (comp.databases.theory)
  • Re: Variable name length
    ... Didn't find the MySQL one at all; and I didn't see a number in the PHP ... reference which I did see, ... That was a sufficient test but I am still tempted to write up a 32k ...
    (comp.lang.php)
  • Re: SQL difference - mySQL and MS SQL
    ... MySQL is pretty far behind most of the other database ... They just added support for things such as stored ... I have never seen such a reference, and it highly depends on the version ... version 4 is nowhere near Microsoft SQL Server (in any version I've ...
    (microsoft.public.sqlserver.connect)
  • Re: insert (now(),now(),....)
    ... In MySQL, it shouldn't, because MySQL guarantees a single statement to be ... If you decide to use user variables, you'd be on the safe side, anyway. ... a variable defined by one client cannot be seen or used by other ...
    (comp.lang.php)