From: | "Kodamasimham Pridhvi (MT2012066)" <Pridhvi(dot)Kodamasimham(at)iiitb(dot)org> |
---|---|
To: | Craig Ringer <craig(at)2ndquadrant(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "Bisen Vikrantsingh Mohansingh MT2012036" <BisenVikrantsingh(dot)Mohansingh(at)iiitb(dot)org> |
Subject: | Re: Proposal for XML Schema Validation |
Date: | 2013-08-09 09:55:18 |
Message-ID: | 09014d1071af4c398d67f8c26bda6a6d@SINPR01MB057.apcprd01.prod.exchangelabs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Craig Ringer,
(Sorry for reposting it as it got posted in different thread previously)
yeah, you are right indeed. I tried to answer your question in three section as below.
(A) XML Schema update
User may wish to update schema in future. So we will provide them one more function
UPDATE_XML_SCHEMA("<URL OF SCHEMA>","<NAMESPACE>","<NEW CONTENT OF .XSD>")
Here we are assuming URL OF SCHEMA as a primary key. And we will overwrite content of .xsd field no provision
of altering a selective portion xsd in place.
Whenever an update to schema happens
before committing changes we will run small algo as below
1. For all table in which this schema is used
2. if(!validate xml document for each row)
3. abort/exit with error;
4. commit
If user modify schema by adding some extra optional tags then their won't be any error
,error will arise in cases such as adding new compulsory/required tags, datatype in .xsd for
certain tag is modified. This is beyond our control an obvious solution as suggested by you
could be used, user will manually go through rows which are violating schema (for simplicity,
we will mention row number which are violating schema in our error message) and do
modification/deletion as required.
(
similar case happen, suppose you have a table t(a,b,c) with lot of data, later on
you want to add primary key constraints to column 'a', but if data in column 'a' is
not unique then it may fail, and user has to manually handle this situation may be by deleting or
modifying respective rows.
)
(B) Alter Table
Only sole purpose of making use of keyword USE_SCHEMA is to mimic oracle (somewhere on
oracle site i found this type of syntax), I may not be correct but check constraint is only used to
limit the value ranges. So it is better to introduce new meaningful keyword or else no problem
to work embed this feature with CHECK()
(C)
yes , there are memory management related issue with libxml as mentioned on below link
http://wiki.postgresql.org/wiki/XML_Support#Implementation_Issues
It is also mention there that this issue can be resolved(how? don't know!).
Thanks,
Pridhvi & Vikrantsingh
IIIT Bangalore
________________________________________
From: Craig Ringer <craig(at)2ndquadrant(dot)com>
Sent: Friday, August 09, 2013 8:27 AM
To: Kodamasimham Pridhvi (MT2012066)
Cc: pgsql-hackers(at)postgresql(dot)org; Bisen Vikrantsingh Mohansingh MT2012036
Subject: Re: [HACKERS] Proposal for XML Schema Validation
On 08/09/2013 12:39 AM, Kodamasimham Pridhvi (MT2012066) wrote:
>
> Objective: To Add XML Schema validation and xmlvalidate functions (SQL:2008)
>
> Description:
> We’ve gone through current support of xml in postgreSQL and found that there is a check for well-formedness of xml document while inserting and updating. We want to extend this feature by adding xml schema validation.
> We will be providing user with DDL commands for creating and deleting XML Schema, also provision of associating xml schema with table while creation of new table or while altering table structure, we are planning to use libxml2 library. Proposed syntax is given below.
The first thing that comes to mind here is "what if the user wants to
update/replace the schema" ? How would you handle re-validating the fields?
Sure, updating XML schemas is not a great idea, but it doesn't stop
people doing it. It might be reasonable to say "if you want to do this
you have to drop the dependent constraints, drop the schema, re-create
the schema and re-create the schema constraints" though.
Why extend the create table / alter table syntax with "USE_SCHEMA"? Is
there a compatibility/standards reason to do this? If not, what
advantage does this provide over using a suitable CHECK constraint?
IIRC there were some memory management issues with libxml2 in Pg. Anyone
remember anything about that?
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Bisen Vikrantsingh Mohansingh MT2012036 | 2013-08-09 10:03:37 | Re: Proposal for XML Schema Validation |
Previous Message | Kodamasimham Pridhvi (MT2012066) | 2013-08-09 09:47:02 | FW: Proposal for XML Schema Validation |