[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Read-Only View

Posted on 2008-06-24
5
Medium Priority
?
1,273 Views
Last Modified: 2010-05-18
How do I make a view read only?  I do not want update, replace, insert, delete ext... to work on the view.  I want only select query's to run.
0
Comment
Question by:kyleroi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 20

Expert Comment

by:virmaior
ID: 21860777
you add a user to MySQL and only give them SELECT rights on the relevant table and database.
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 21860810
    Hi!

If you want to have the view read only the only thing you have to do is
not write the create view statement with the "with [cascaded/loca] check option"

http://dev.mysql.com/doc/refman/5.0/en/create-view.html

Regards,
   Tomas Helgi
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 21860821
If a view is without the "...check option" the view
is automatically read only.

Regards,
    Tomas Helgi
0
 
LVL 1

Author Comment

by:kyleroi
ID: 21865906
I do not have the check option in my query although it still allows me to delete records from the view and ultimately from the source.  Below is the view creation query.
CREATE OR REPLACE ALGORITHM=UNDEFINED DEFINER=`rmast`@`%` SQL SECURITY DEFINER VIEW `newbus`.`client` AS select `roidata`.`client`.`client` AS `client`,`roidata`.`client`.`tob` AS `tob`,`roidata`.`client`.`afacility` AS `afacility`,`roidata`.`client`.`facility` AS `facility`,`roidata`.`client`.`plcschedul` AS `plcschedul`,`roidata`.`client`.`soa_level_` AS `soa_level_`,`roidata`.`client`.`soa_level2` AS `soa_level2`,`roidata`.`client`.`soa_cl` AS `soa_cl`,`roidata`.`client`.`rptlevel` AS `rptlevel`,`roidata`.`client`.`rate` AS `rate`,`roidata`.`client`.`insscrner` AS `insscrner`,`roidata`.`client`.`dialtype` AS `dialtype`,`roidata`.`client`.`dialtime` AS `dialtime`,`roidata`.`client`.`site` AS `site`,`roidata`.`client`.`allserve_p` AS `allserve_p`,`roidata`.`client`.`allserve_i` AS `allserve_i`,`roidata`.`client`.`frontline` AS `frontline`,`roidata`.`client`.`typeofbus` AS `typeofbus`,`roidata`.`client`.`fixedfee` AS `fixedfee`,`roidata`.`client`.`netgross` AS `netgross`,`roidata`.`client`.`courtcost` AS `courtcost`,`roidata`.`client`.`legalrate` AS `legalrate`,`roidata`.`client`.`lnetgross` AS `lnetgross`,`roidata`.`client`.`ratecode` AS `ratecode`,`roidata`.`client`.`rangefrom` AS `rangefrom`,`roidata`.`client`.`rangeto` AS `rangeto`,`roidata`.`client`.`capamt` AS `capamt`,`roidata`.`client`.`combclient` AS `combclient`,`roidata`.`client`.`combtob` AS `combtob`,`roidata`.`client`.`combfac` AS `combfac`,`roidata`.`client`.`facname` AS `facname`,`roidata`.`client`.`rptname` AS `rptname`,`roidata`.`client`.`addr` AS `addr`,`roidata`.`client`.`addr2` AS `addr2`,`roidata`.`client`.`state` AS `state`,`roidata`.`client`.`zip` AS `zip`,`roidata`.`client`.`zip2` AS `zip2`,`roidata`.`client`.`area` AS `area`,`roidata`.`client`.`phone` AS `phone`,`roidata`.`client`.`taxid` AS `taxid`,`roidata`.`client`.`taxcode` AS `taxcode`,`roidata`.`client`.`settlepct` AS `settlepct`,`roidata`.`client`.`add_date` AS `add_date`,`roidata`.`client`.`inactive` AS `inactive`,`roidata`.`client`.`close_date` AS `close_date`,`roidata`.`client`.`fastmo` AS `fastmo`,`roidata`.`client`.`fastdy` AS `fastdy`,`roidata`.`client`.`fastyr` AS `fastyr`,`roidata`.`client`.`legalfeeop` AS `legalfeeop`,`roidata`.`client`.`ar` AS `ar`,`roidata`.`client`.`legalar` AS `legalar`,`roidata`.`client`.`daytoprt` AS `daytoprt`,`roidata`.`client`.`ackrpt` AS `ackrpt`,`roidata`.`client`.`ltrgroup` AS `ltrgroup`,`roidata`.`client`.`minbal` AS `minbal`,`roidata`.`client`.`maxbal` AS `maxbal`,`roidata`.`client`.`allowsuit` AS `allowsuit`,`roidata`.`client`.`minbalsue` AS `minbalsue`,`roidata`.`client`.`allowcash` AS `allowcash`,`roidata`.`client`.`mailname` AS `mailname`,`roidata`.`client`.`mailaddr` AS `mailaddr`,`roidata`.`client`.`mailaddr2` AS `mailaddr2`,`roidata`.`client`.`mailcity` AS `mailcity`,`roidata`.`client`.`mailzip` AS `mailzip`,`roidata`.`client`.`mailzip2` AS `mailzip2`,`roidata`.`client`.`contact` AS `contact`,`roidata`.`client`.`oldroi` AS `oldroi`,`roidata`.`client`.`mejan` AS `mejan`,`roidata`.`client`.`mefeb` AS `mefeb`,`roidata`.`client`.`memar` AS `memar`,`roidata`.`client`.`meapr` AS `meapr`,`roidata`.`client`.`memay` AS `memay`,`roidata`.`client`.`mejun` AS `mejun`,`roidata`.`client`.`mejul` AS `mejul`,`roidata`.`client`.`meaug` AS `meaug`,`roidata`.`client`.`mesep` AS `mesep`,`roidata`.`client`.`meoct` AS `meoct`,`roidata`.`client`.`menov` AS `menov`,`roidata`.`client`.`medec` AS `medec`,`roidata`.`client`.`curryr` AS `curryr`,`roidata`.`client`.`prioryrend` AS `prioryrend`,`roidata`.`client`.`priorend` AS `priorend`,`roidata`.`client`.`hosptype` AS `hosptype`,`roidata`.`client`.`pyrendjan` AS `pyrendjan`,`roidata`.`client`.`pyrendfeb` AS `pyrendfeb`,`roidata`.`client`.`pyrendmar` AS `pyrendmar`,`roidata`.`client`.`pyrendapr` AS `pyrendapr`,`roidata`.`client`.`pyrendmay` AS `pyrendmay`,`roidata`.`client`.`pyrendjun` AS `pyrendjun`,`roidata`.`client`.`pyrendjul` AS `pyrendjul`,`roidata`.`client`.`pyrendaug` AS `pyrendaug`,`roidata`.`client`.`pyrendsep` AS `pyrendsep`,`roidata`.`client`.`pyrendoct` AS `pyrendoct`,`roidata`.`client`.`pyrendnov` AS `pyrendnov`,`roidata`.`client`.`pyrenddec` AS `pyrenddec`,`roidata`.`client`.`changes` AS `changes`,`roidata`.`client`.`typeofplac` AS `typeofplac`,`roidata`.`client`.`salespersn` AS `salespersn`,`roidata`.`client`.`budgetpers` AS `budgetpers`,`roidata`.`client`.`lstlddt` AS `lstlddt`,`roidata`.`client`.`lstldnoaccts` AS `lstldnoaccts`,`roidata`.`client`.`lstldamt` AS `lstldamt`,`roidata`.`client`.`ccaccept` AS `ccaccept`,`roidata`.`client`.`graceper` AS `graceper` from `roidata`.`client`

Open in new window

0
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 2000 total points
ID: 21866718
Hmmm also try to skip the ALGORITHM, DEFINER and the SQL SECURITY options from the creation of the view.
To use those options you must carefully describe who has what kind of access to the table (SELECT,INSERT,UPDATE,DELETE). As described in the manual posted earlier a user who invokes this kind of view
and has DELETE access to the table can delete from the table through the view.

Regards,
   Tomas Helgi  
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we’ll look at how to deploy ProxySQL.
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question