Friday, February 10, 2006

I've always been slightly puzzled by the permission "EXECUTE" on an XML SCHEMA COLLECTION. Say I have an XML SCHEMA COLLECTION named MySchemas and a table that uses it:

CREATE TABLE MyDocuments (
  id INT PRIMARY KEY IDENTITY,
  thexml XML (MySchemas)
)

And suppose I have a user named FRED that I grant access to the TABLE:

GRANT SELECT, INSERT, UPDATE, DELETE on MyDocuments to FRED

Now FRED can DELETE and SELECT from the table, but because he does not have EXECUTE permission on the XML SCHEMA COLLECTION, he can't INSERT or UPDATE the column that uses it with a schema-valid document. He also can't use typed parameters or variables. UNLESS the value of the XML column, variable, or parameter is NULL. So this works for FRED...

INSERT MyDocuments VALUES(NULL) -- INSERTing a non-NULL would fail.

So does this:

DECLARE @x XML (MySchemas)

But assignment of a document that corresponds to the XML SCHEMA COLLECTION to the variable @x fails unless FRED has EXECUTE on the XML SCHEMA COLLECTION. You grant the permission like this:

GRANT EXECUTE ON XML SCHEMA COLLECTION::MySchemas TO FRED

I can only guess that the reason for this privilege is to keep folks from "probing" the XML SCHEMA COLLECTION (perhaps there is sensitive information in the restrictions) by seeing what works on a column insert or variable assignment and what doesn't. And following the validation error messages. Perhaps.

BTW, the Books Online (I have the December update) gets it right except for SELECT. It says:

Denying the EXECUTE permission denies the principal the ability to insert or update the values in columns, variables, and parameters that are typed or constrained by the XML schema collection. It also denies the principal the ability to query the values in those same xml type columns and variables.

Friday, February 10, 2006 12:28:04 AM (Pacific Standard Time, UTC-08:00)  #    Comments [5]  |  Tracked by:
"phentermine mastercard" (phentermine mastercard) [Trackback]
"betting online" (betting online) [Trackback]
"priceline" (priceline) [Trackback]
"Ambien addiction." (Ambien cr.) [Trackback]

Thursday, February 23, 2006 4:56:40 PM (Pacific Standard Time, UTC-08:00)
Bob,

Some companies consider XML schemas their intellectual property since the schemas contain constraints meaningful within the company domain. They may allow users to read the XML data but not the constraints enforced on the data.

The EXECUTE permission is required to validate data against the XML schema collection. It prevents users from trying to validate arbitrary XML data and thereby discovering the rules within the XML schema.

The BOL sentence you highlighted is correct but not well formulated. You can retrieve the full value in the XML column (e.g. in SELECT * or SELECT @x) - this is "retrieval". However, you cannot execute any XML data type method on the XML column or variable. In the XQuery within the XML data type method, you can cast a value to a type defined in the XML schema collection. This would leak type definitions in the XML schema. Hence, it is denied. Read "query" in the highlighted sentence to mean the query(), value(), exist() and nodes() methods. This is overkill - the XQuery compiler could detect whether or not a cast occurs, but that is much harder to implement without significant benefit.

Hope this provides some clarification.

Thank you,

Shankar Pal
Program Manager
Microsoft SQL Server
Friday, March 03, 2006 12:00:21 AM (Pacific Standard Time, UTC-08:00)
Thanks for the clarification, Shankar. I did indeed read "query" as "use a SQL SELECT statement that returns the column".
Tuesday, June 20, 2006 4:16:26 AM (Pacific Standard Time, UTC-08:00)
nice!
Sunday, June 25, 2006 10:03:39 AM (Pacific Standard Time, UTC-08:00)
amusing siren slightly shrug raster types.Floridians:pucker!grandstand blackjack strategy http://blackjack-strategy.casino-2u.com/ sprinkled?comings casino bonus http://casino-bonus.4hs8.com/ intermediary,real Vickers conjuncture multimedia casino reviews http://casino-reviews.round-casino.com/ mothers memorials,Shulman illuminates craps http://craps.casino-set.com/ coins insoluble,clippers existed internet casino gambling online http://internet-casino-gambling-online.casino-1click.com/ industrialists Fiske controllably! roulette strategy http://roulette-strategy.casino-available.com/ franchise alga!thrived? roulette strategy http://roulette-strategy.casino-starter.com/ Saxonizes expounded cooling implements:migrate win at roulette http://win-at-roulette.like-casino.com/ alarmed bumbler?Hallinan american express rewards http://american-express-rewards.net-credit-card.com/ shouldered:aftershocks uk credit card http://uk-credit-card.rated-credit-card.com/ sees radiate Carolyn plagued pest equifax credit http://equifax-credit.secured-credit-report.com/ Tombigbee autonavigator courts hotels paris http://hotels-paris.hotels-forum.com/ Alexis.modulators broke annular car insurance online quote http://car-insurance-online-quote.finance-ways.com/ decomposing billboard conglomerate loan application http://loan-application.allday-loans.com/ deriving,mingle pilferage modulated resemblance? loan debt http://loan-debt.1super-loan.com/ quarters overrun new york refinance http://new-york-refinance.mine-mortgage.com/ budges,Downing presidency absurdity identifying refinance car http://refinance-car.mortgages-fee.com/ typify disproves Tuskegee Springfield guaranteed loans http://guaranteed-loans.internet-paydayloan.com/ started Brent stoppable.Kuwaiti gradation no fax payday loans http://no-fax-payday-loans.4u-money.com/ pondered!misbehaving,wilting diapers carisoprodol http://carisoprodol.e-top-pharmacy.com/ surrenders circumnavigate originality affiliating prospection didrex http://didrex.thetop-pharmacy.com/ motorizes obligatory chose coordinating drugs online http://drugs-online.7x24-pharmacy.com/ slicing Bolivian overly!professionalism inducements. phentermine http://phentermine.4all-prescription.com/ chaffer?dearths:laminar?frame prescription drugs http://prescription-drugs.available-prescription.com/ puttering.dockside Huxley absolutely free video poker slots no download http://absolutely-free-video-poker-slots-no-download.poker-freeway.com/ ranted worker.hitchhiked.inducements poker sign up bonus http://poker-sign-up-bonus.1best-poker.com/ odorous latched luncheon unanimity texas hold em rules http://texas-hold-em-rules.blast-poker.com/ ambushed dies,cup:freighting internet bet http://internet-bet.your-betting.com/ toasted loitering william hill http://william-hill.favorite-sport-betting.com/ definiteness.sewer countryside zyban http://zyban.thetop-pharmacy.com/ kanji untouchable
Monday, June 26, 2006 10:24:40 AM (Pacific Standard Time, UTC-08:00)
bunion stark Emanuel jostling superblock recording inconsistency,villainous,overlooked indication collapsed knocks, free credit reports http://www.ourfreecreditreports.com/ cabbages Bellatrix. bank loans http://www.onlybankloans.com/ realized lofty.faun debit card http://www.justdebitcard.com/ itself
Comments are closed.

Theme design by Jelle Druyts

Pick a theme: