SlideShare a Scribd company logo
1 of 19
Download to read offline
XML Support
Specifications and Development


         Peter Eisentraut


PostgreSQL Anniversary Summit
        July 8–9, 2006
            Toronto




     Peter Eisentraut   XML Support
XML Support




  Types of “XML Support”:
      XML data type and support functions
      XML export format
      Mapping XML documents to SQL databases




                     Peter Eisentraut   XML Support
Specifications




      ISO/IEC 9075-14:2003 (“XML-Related Specifications” –
      SQL/XML)
      ISO/IEC 9075-14:2006, as of 2006-06-12
  Already implemented by IBM DB/2, Microsoft SQL Server,
  OpenLink Virtuoso, Oracle, . . .
  More information: http://www.sqlx.org/




                     Peter Eisentraut   XML Support
XML Data Type



  CREATE TABLE test (
      ...,
      data xml,
      ...
  );

  Features:
      Input checking
      Support functions




                       Peter Eisentraut   XML Support
XML Input/Output




  No string literals as input

  XMLPARSE ( DOCUMENT|CONTENT value ) --> xml

  XMLSERIALIZE ( DOCUMENT|CONTENT xmlvalue AS
      varchar ) --> varchar

  These could serve as PostgreSQL input/output functions.




                         Peter Eisentraut   XML Support
XML Support Functions



     XMLCOMMENT
     XMLCONCAT
     XMLELEMENT
     XMLFOREST
     XMLPI
     XMLROOT
     XMLAGG
     IS DOCUMENT, IS NOT DOCUMENT




                  Peter Eisentraut   XML Support
XMLELEMENT Example


 XMLROOT (                          <?xml version=’1.0’
   XMLELEMENT (                           standalone=’yes’ ?>
     NAME ’gazonk’,                 <gazonk name=’val’
     XMLATTRIBUTES (                        num=’2’>
       ’val’ AS ’name’,               <qux>foo</qux>
       1 + 1 AS ’num’               </gazonk>
     ),
     XMLELEMENT (
       NAME ’qux’,
       ’foo’
     )
   ),
   VERSION ’1.0’,
   STANDALONE YES
 )
                Peter Eisentraut   XML Support
XMLFOREST Example
 SELECT xmlforest (
   "FirstName" as "FName", "LastName" as "LName",
   ’string’ as "str", "Title", "Region" )
 FROM "Demo"."demo"."Employees";
 might result in
 <FName>Nancy</FName>
 <LName>Davolio</LName>
 <str>string</str>
 <Title>Sales Representative</Title>
 <Region>WA</Region>

 . . .

 <FName>Anne</FName>
 <LName>Dodsworth</LName>
 <str>string</str>
 <Title>Sales Representative</Title>

 (1 row per record)
                      Peter Eisentraut   XML Support
XMLAGG Example

 SELECT xmlelement (’Emp’,
   xmlattributes (’Sales Representative’ as "Title"),
   xmlagg (xmlelement (’Name’, "FirstName", ’ ’,
                       "LastName")))
   FROM "Demo"."demo"."Employees"
   WHERE "Title" = ’Sales Representative’;

 might result in

 <Emp Title="Sales Representative">
   <Name>Nancy Davolio</Name>
   <Name>Janet Leverling</Name>
   <Name>Margaret Peacock</Name>
   <Name>Michael Suyama</Name>
   <Name>Robert King</Name>
   <Name>Anne Dodsworth</Name>
 </Emp>

 (1 row)
                   Peter Eisentraut   XML Support
SQL:2006
    More specific XML data type:
    XML
    XML(DOCUMENT)
    XML(CONTENT)
    XML(SEQUENCE)
    XML(DOCUMENT(ANY))
    XML(DOCUMENT(UNTYPED))
    XML(DOCUMENT(XMLSCHEMA ’http://...’))
    More functions:
    XMLDOCUMENT
    XMLTEXT
    XMLVALIDATE
    IS CONTENT
    IS VALID
    More options everywhere
    XQuery
                Peter Eisentraut   XML Support
XML Data Type Status



  Current status:
      Google Summer of Code project works on SQL:2003
      (Nikolay Samokhvalov)
      Previous patches for support functions available, but work
      with text data type (Pavel Stehule)
  Also:
      Integrate contrib/xml functionality




                       Peter Eisentraut   XML Support
Implementation Issues




  Uses libxml (LGPL)
      Encoding handling
      Memory management
      Optional/mandatory?




                       Peter Eisentraut   XML Support
For the Future




     XQuery support (SQL:2006)
     Ctree indexes




                     Peter Eisentraut   XML Support
XML Export Format




      Map SQL schema to XML Schema
      Map database contents to XML document
  Useful for:
      Postprocessing using XSLT
      pg_dump
      psql?




                     Peter Eisentraut   XML Support
Mapping Names




  SQL <identifier>   fully-escaped XML name             partially-escaped XML name
  employee          EMPLOYEE                           EMPLOYEE
  "employee"        employee                           employee
  "hire date"       hire_x0020_date                    hire_x0020_date
  "comp_plan"       comp_x005F_plan                    comp_x005F_plan
  "dept:id"         dept_x003A_id                      dept:id
  xmlcol            _xFFFF_xmlcol                      xmlcol




                      Peter Eisentraut   XML Support
XML Schema Mapping Example

  CREATE TABLE test (a int PRIMARY KEY, b varchar(200));

  is mapped to
  <xsd:complexType name="RowType.catalog.schema.test">
    <xsd:sequence>
      <xsd:element name="a" type="INTEGER"></xsd:element>
      <xsd:element name="b" type="VARCHAR_200_200"
          minOccurs="0"></xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="TableType.catalog.schema.test">
    <xsd:sequence>
      <xsd:element name="row"
          type="RowType.catalog.schema.test"
          minOccurs="0"
          maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

                    Peter Eisentraut   XML Support
XML Export Format Example

  <catalogname>
    <schemaname>
      <tablename>
        <row>
          <colname1>value</colname1>
          <colname2 xsi:nil=’true’/>
          ...
        </row>
        ...
      </tablename>
      ...
    </schemaname>
    ...
  </catalogname>


                 Peter Eisentraut   XML Support
XML Export Format Status




      Prototype available
      Would like XML data type first
  Where to put it?
      pg_dump?
      psql?
      user-defined functions?




                      Peter Eisentraut   XML Support
<?end ?>




Peter Eisentraut   XML Support

More Related Content

What's hot

BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7Georgi Kodinov
 
Using JSON with MariaDB and MySQL
Using JSON with MariaDB and MySQLUsing JSON with MariaDB and MySQL
Using JSON with MariaDB and MySQLAnders Karlsson
 
Troubleshooting MySQL Performance add-ons
Troubleshooting MySQL Performance add-onsTroubleshooting MySQL Performance add-ons
Troubleshooting MySQL Performance add-onsSveta Smirnova
 
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Marco Gralike
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Marco Gralike
 
Developing Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersDeveloping Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersSaeid Zebardast
 
ERRest - The Next Steps
ERRest - The Next StepsERRest - The Next Steps
ERRest - The Next StepsWO Community
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesMarco Gralike
 
TSQL Coding Guidelines
TSQL Coding GuidelinesTSQL Coding Guidelines
TSQL Coding GuidelinesChris Adkin
 
Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6MYXPLAIN
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseMarco Gralike
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorialGiuseppe Maxia
 
Explaining the MySQL Explain
Explaining the MySQL ExplainExplaining the MySQL Explain
Explaining the MySQL ExplainMYXPLAIN
 
The Ring programming language version 1.5.3 book - Part 37 of 184
The Ring programming language version 1.5.3 book - Part 37 of 184The Ring programming language version 1.5.3 book - Part 37 of 184
The Ring programming language version 1.5.3 book - Part 37 of 184Mahmoud Samir Fayed
 
Brief introduction of Slick
Brief introduction of SlickBrief introduction of Slick
Brief introduction of SlickKnoldus Inc.
 
Xml generation and extraction using XMLDB
Xml generation and extraction using XMLDBXml generation and extraction using XMLDB
Xml generation and extraction using XMLDBpallavi kasibhotla
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Rebecca Grenier
 

What's hot (20)

BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7BGOUG15: JSON support in MySQL 5.7
BGOUG15: JSON support in MySQL 5.7
 
Using JSON with MariaDB and MySQL
Using JSON with MariaDB and MySQLUsing JSON with MariaDB and MySQL
Using JSON with MariaDB and MySQL
 
SQL injection: Not only AND 1=1
SQL injection: Not only AND 1=1SQL injection: Not only AND 1=1
SQL injection: Not only AND 1=1
 
Troubleshooting MySQL Performance add-ons
Troubleshooting MySQL Performance add-onsTroubleshooting MySQL Performance add-ons
Troubleshooting MySQL Performance add-ons
 
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
Oracle Developer Day, 20 October 2009, Oracle De Meern, Holland: Oracle Datab...
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2
 
Developing Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginnersDeveloping Applications with MySQL and Java for beginners
Developing Applications with MySQL and Java for beginners
 
ERRest - The Next Steps
ERRest - The Next StepsERRest - The Next Steps
ERRest - The Next Steps
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
 
TSQL Coding Guidelines
TSQL Coding GuidelinesTSQL Coding Guidelines
TSQL Coding Guidelines
 
Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6Powerful Explain in MySQL 5.6
Powerful Explain in MySQL 5.6
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
 
Explaining the MySQL Explain
Explaining the MySQL ExplainExplaining the MySQL Explain
Explaining the MySQL Explain
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
The Ring programming language version 1.5.3 book - Part 37 of 184
The Ring programming language version 1.5.3 book - Part 37 of 184The Ring programming language version 1.5.3 book - Part 37 of 184
The Ring programming language version 1.5.3 book - Part 37 of 184
 
Brief introduction of Slick
Brief introduction of SlickBrief introduction of Slick
Brief introduction of Slick
 
Xml generation and extraction using XMLDB
Xml generation and extraction using XMLDBXml generation and extraction using XMLDB
Xml generation and extraction using XMLDB
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access Slick: Bringing Scala’s Powerful Features to Your Database Access
Slick: Bringing Scala’s Powerful Features to Your Database Access
 

Viewers also liked

Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloudPeter Eisentraut
 
Most Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesMost Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesPeter Eisentraut
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPeter Eisentraut
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/ProxyPeter Eisentraut
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptSurvey Department
 
The Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future DevelopmentsThe Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future DevelopmentsPeter Eisentraut
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)Peter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...Peter Eisentraut
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 

Viewers also liked (9)

Linux distribution for the cloud
Linux distribution for the cloudLinux distribution for the cloud
Linux distribution for the cloud
 
Most Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL FeaturesMost Wanted: Future PostgreSQL Features
Most Wanted: Future PostgreSQL Features
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
Getting Started with PL/Proxy
Getting Started with PL/ProxyGetting Started with PL/Proxy
Getting Started with PL/Proxy
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
 
The Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future DevelopmentsThe Road to the XML Type: Current and Future Developments
The Road to the XML Type: Current and Future Developments
 
The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)The Common Debian Build System (CDBS)
The Common Debian Build System (CDBS)
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...Collateral Damage:
Consequences of Spam and Virus Filtering for the E-Mail S...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail S...
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 

Similar to PostgreSQL XML Support Functions and Data Type

Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handlingazharpro
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamudAsfak Mahamud
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Languageelliando dias
 
Wso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1stWso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1stWSO2
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersAmanda Gilmore
 
XML & XPath Injections
XML & XPath InjectionsXML & XPath Injections
XML & XPath InjectionsAMol NAik
 
XPath - XML Path Language
XPath - XML Path LanguageXPath - XML Path Language
XPath - XML Path Languageyht4ever
 
Handling XML and JSON in the Database
Handling XML and JSON in the DatabaseHandling XML and JSON in the Database
Handling XML and JSON in the DatabaseMike Fowler
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsAnton Keks
 
Xml Java
Xml JavaXml Java
Xml Javacbee48
 
Pxb For Yapc2008
Pxb For Yapc2008Pxb For Yapc2008
Pxb For Yapc2008maximgrp
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for PerlGeir Aalberg
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the ASTJarrod Overson
 

Similar to PostgreSQL XML Support Functions and Data Type (20)

DB2 Native XML
DB2 Native XMLDB2 Native XML
DB2 Native XML
 
Oracle XML Handling
Oracle XML HandlingOracle XML Handling
Oracle XML Handling
 
Xml presentation
Xml presentationXml presentation
Xml presentation
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
Xslt by asfak mahamud
Xslt by asfak mahamudXslt by asfak mahamud
Xslt by asfak mahamud
 
SXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup LanguageSXML: S-expression eXtensible Markup Language
SXML: S-expression eXtensible Markup Language
 
XML for bioinformatics
XML for bioinformaticsXML for bioinformatics
XML for bioinformatics
 
Wso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1stWso2 Scenarios Esb Webinar July 1st
Wso2 Scenarios Esb Webinar July 1st
 
Xml session
Xml sessionXml session
Xml session
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
Xml 2
Xml  2 Xml  2
Xml 2
 
PostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL SuperpowersPostgreSQL's Secret NoSQL Superpowers
PostgreSQL's Secret NoSQL Superpowers
 
XML & XPath Injections
XML & XPath InjectionsXML & XPath Injections
XML & XPath Injections
 
XPath - XML Path Language
XPath - XML Path LanguageXPath - XML Path Language
XPath - XML Path Language
 
Handling XML and JSON in the Database
Handling XML and JSON in the DatabaseHandling XML and JSON in the Database
Handling XML and JSON in the Database
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
 
Xml Java
Xml JavaXml Java
Xml Java
 
Pxb For Yapc2008
Pxb For Yapc2008Pxb For Yapc2008
Pxb For Yapc2008
 
XML Tools for Perl
XML Tools for PerlXML Tools for Perl
XML Tools for Perl
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the AST
 

More from Peter Eisentraut

Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPeter Eisentraut
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQLPeter Eisentraut
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsPeter Eisentraut
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLPeter Eisentraut
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Peter Eisentraut
 
The Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewhereThe Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewherePeter Eisentraut
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLPeter Eisentraut
 

More from Peter Eisentraut (14)

Porting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQLPorting Oracle Applications to PostgreSQL
Porting Oracle Applications to PostgreSQL
 
PostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie DatenbankalternativePostgreSQL: Die Freie Datenbankalternative
PostgreSQL: Die Freie Datenbankalternative
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
PostgreSQL and PL/Java
PostgreSQL and PL/JavaPostgreSQL and PL/Java
PostgreSQL and PL/Java
 
Replication Solutions for PostgreSQL
Replication Solutions for PostgreSQLReplication Solutions for PostgreSQL
Replication Solutions for PostgreSQL
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
PostgreSQL News
PostgreSQL NewsPostgreSQL News
PostgreSQL News
 
Access ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-FrontendsAccess ohne Access: Freie Datenbank-Frontends
Access ohne Access: Freie Datenbank-Frontends
 
Docbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XMLDocbook: Textverarbeitung mit XML
Docbook: Textverarbeitung mit XML
 
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
Collateral Damage: Consequences of Spam and Virus Filtering for the E-Mail Sy...
 
Spaß mit PostgreSQL
Spaß mit PostgreSQLSpaß mit PostgreSQL
Spaß mit PostgreSQL
 
SQL/MED and PostgreSQL
SQL/MED and PostgreSQLSQL/MED and PostgreSQL
SQL/MED and PostgreSQL
 
The Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices ElsewhereThe Lives of Others: Open-Source Development Practices Elsewhere
The Lives of Others: Open-Source Development Practices Elsewhere
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQL
 

Recently uploaded

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

PostgreSQL XML Support Functions and Data Type

  • 1. XML Support Specifications and Development Peter Eisentraut PostgreSQL Anniversary Summit July 8–9, 2006 Toronto Peter Eisentraut XML Support
  • 2. XML Support Types of “XML Support”: XML data type and support functions XML export format Mapping XML documents to SQL databases Peter Eisentraut XML Support
  • 3. Specifications ISO/IEC 9075-14:2003 (“XML-Related Specifications” – SQL/XML) ISO/IEC 9075-14:2006, as of 2006-06-12 Already implemented by IBM DB/2, Microsoft SQL Server, OpenLink Virtuoso, Oracle, . . . More information: http://www.sqlx.org/ Peter Eisentraut XML Support
  • 4. XML Data Type CREATE TABLE test ( ..., data xml, ... ); Features: Input checking Support functions Peter Eisentraut XML Support
  • 5. XML Input/Output No string literals as input XMLPARSE ( DOCUMENT|CONTENT value ) --> xml XMLSERIALIZE ( DOCUMENT|CONTENT xmlvalue AS varchar ) --> varchar These could serve as PostgreSQL input/output functions. Peter Eisentraut XML Support
  • 6. XML Support Functions XMLCOMMENT XMLCONCAT XMLELEMENT XMLFOREST XMLPI XMLROOT XMLAGG IS DOCUMENT, IS NOT DOCUMENT Peter Eisentraut XML Support
  • 7. XMLELEMENT Example XMLROOT ( <?xml version=’1.0’ XMLELEMENT ( standalone=’yes’ ?> NAME ’gazonk’, <gazonk name=’val’ XMLATTRIBUTES ( num=’2’> ’val’ AS ’name’, <qux>foo</qux> 1 + 1 AS ’num’ </gazonk> ), XMLELEMENT ( NAME ’qux’, ’foo’ ) ), VERSION ’1.0’, STANDALONE YES ) Peter Eisentraut XML Support
  • 8. XMLFOREST Example SELECT xmlforest ( "FirstName" as "FName", "LastName" as "LName", ’string’ as "str", "Title", "Region" ) FROM "Demo"."demo"."Employees"; might result in <FName>Nancy</FName> <LName>Davolio</LName> <str>string</str> <Title>Sales Representative</Title> <Region>WA</Region> . . . <FName>Anne</FName> <LName>Dodsworth</LName> <str>string</str> <Title>Sales Representative</Title> (1 row per record) Peter Eisentraut XML Support
  • 9. XMLAGG Example SELECT xmlelement (’Emp’, xmlattributes (’Sales Representative’ as "Title"), xmlagg (xmlelement (’Name’, "FirstName", ’ ’, "LastName"))) FROM "Demo"."demo"."Employees" WHERE "Title" = ’Sales Representative’; might result in <Emp Title="Sales Representative"> <Name>Nancy Davolio</Name> <Name>Janet Leverling</Name> <Name>Margaret Peacock</Name> <Name>Michael Suyama</Name> <Name>Robert King</Name> <Name>Anne Dodsworth</Name> </Emp> (1 row) Peter Eisentraut XML Support
  • 10. SQL:2006 More specific XML data type: XML XML(DOCUMENT) XML(CONTENT) XML(SEQUENCE) XML(DOCUMENT(ANY)) XML(DOCUMENT(UNTYPED)) XML(DOCUMENT(XMLSCHEMA ’http://...’)) More functions: XMLDOCUMENT XMLTEXT XMLVALIDATE IS CONTENT IS VALID More options everywhere XQuery Peter Eisentraut XML Support
  • 11. XML Data Type Status Current status: Google Summer of Code project works on SQL:2003 (Nikolay Samokhvalov) Previous patches for support functions available, but work with text data type (Pavel Stehule) Also: Integrate contrib/xml functionality Peter Eisentraut XML Support
  • 12. Implementation Issues Uses libxml (LGPL) Encoding handling Memory management Optional/mandatory? Peter Eisentraut XML Support
  • 13. For the Future XQuery support (SQL:2006) Ctree indexes Peter Eisentraut XML Support
  • 14. XML Export Format Map SQL schema to XML Schema Map database contents to XML document Useful for: Postprocessing using XSLT pg_dump psql? Peter Eisentraut XML Support
  • 15. Mapping Names SQL <identifier> fully-escaped XML name partially-escaped XML name employee EMPLOYEE EMPLOYEE "employee" employee employee "hire date" hire_x0020_date hire_x0020_date "comp_plan" comp_x005F_plan comp_x005F_plan "dept:id" dept_x003A_id dept:id xmlcol _xFFFF_xmlcol xmlcol Peter Eisentraut XML Support
  • 16. XML Schema Mapping Example CREATE TABLE test (a int PRIMARY KEY, b varchar(200)); is mapped to <xsd:complexType name="RowType.catalog.schema.test"> <xsd:sequence> <xsd:element name="a" type="INTEGER"></xsd:element> <xsd:element name="b" type="VARCHAR_200_200" minOccurs="0"></xsd:element> </xsd:sequence> </xsd:complexType> <xsd:complexType name="TableType.catalog.schema.test"> <xsd:sequence> <xsd:element name="row" type="RowType.catalog.schema.test" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> Peter Eisentraut XML Support
  • 17. XML Export Format Example <catalogname> <schemaname> <tablename> <row> <colname1>value</colname1> <colname2 xsi:nil=’true’/> ... </row> ... </tablename> ... </schemaname> ... </catalogname> Peter Eisentraut XML Support
  • 18. XML Export Format Status Prototype available Would like XML data type first Where to put it? pg_dump? psql? user-defined functions? Peter Eisentraut XML Support