XSLT could be used to convert virtually any xml table format directly
into an insert statement.  For me, this is better than using a
programming language plus a parser.  XSLT is quite powerful and fast and
is build on top of xpath, and is a closer fit to the declarative
programming model of sql.  Validation could be done at the xslt stage or
with schemas, which I prefer.

 
> Acually, the difficult part has been getting the information back
> into the database. Getting it out is a very simple query. I imagine
> that every language/environment has an SQL->XML library somewhere,
> but I wasn't able to find something that would go from XML to SQL.
> 

Wed, 5 Mar 2003 08:15:53 -0500
"Merlin Moncure" <merlin.moncure@rcsonline.com>
Re: XML ouput for psql
I would like to see PostgreSQL eventually support XQuery:

http://www.w3.org/TR/xquery/
http://www.w3.org/TR/query-datamodel/

I see potentially an alternative front end called xsql, providing
substantially the same functionality as psql, only using XQuery syntax and
optionally returning recordsets as XML.

Anybody want to put together a team to explore this seriously? There are
probably several non-trivial semantic issues on the back end, but I only
dimly grasp them at this point.

- Bob Calco

%% -----Original Message-----
%% From: pgsql-hackers-owner@postgresql.org
%% [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Merlin Moncure
%% Sent: Wednesday, March 05, 2003 8:16 AM
%% To: Alan Gutierrez
%% Cc: pgsql-hackers@postgresql.org
%% Subject: Re: [HACKERS] XML ouput for psql
%%
%%
%% XSLT could be used to convert virtually any xml table format directly
%% into an insert statement.  For me, this is better than using a
%% programming language plus a parser.  XSLT is quite powerful and fast and
%% is build on top of xpath, and is a closer fit to the declarative
%% programming model of sql.  Validation could be done at the xslt stage or
%% with schemas, which I prefer.
%%
%%
%% > Acually, the difficult part has been getting the information back
%% > into the database. Getting it out is a very simple query. I imagine
%% > that every language/environment has an SQL->XML library somewhere,
%% > but I wasn't able to find something that would go from XML to SQL.
%% >
%%
%% ---------------------------(end of broadcast)---------------------------
%% TIP 3: if posting/reading through Usenet, please send an appropriate
%% subscribe-nomail command to majordomo@postgresql.org so that your
%% message can get through to the mailing list cleanly



Wed, 5 Mar 2003 09:09:50 -0500
"Bob Calco" <robert.calco@verizon.net>
Re: XML ouput for psql
Bob Calco writes:

> I would like to see PostgreSQL eventually support XQuery:

The specification is here:

ftp://sqlstandards.org/SC32/WG3/Progression_Documents/FCD/4FCD1-14-XML-2002-03.txt

Go for it.

-- 
Peter Eisentraut   peter_e@gmx.net


Wed, 5 Mar 2003 23:39:12 +0100 (CET)
Peter Eisentraut <peter_e@gmx.net>
Re: XML ouput for psql
Thanks for the link - I think I just may give it a go. :)

- Bob

%% -----Original Message-----
%% From: pgsql-hackers-owner@postgresql.org
%% [mailto:pgsql-hackers-owner@postgresql.org]On Behalf Of Peter Eisentraut
%% Sent: Wednesday, March 05, 2003 5:39 PM
%% To: Bob Calco
%% Cc: Merlin Moncure; Alan Gutierrez; pgsql-hackers@postgresql.org
%% Subject: Re: [HACKERS] XML ouput for psql
%% 
%% 
%% Bob Calco writes:
%% 
%% > I would like to see PostgreSQL eventually support XQuery:
%% 
%% The specification is here:
%% 
%% ftp://sqlstandards.org/SC32/WG3/Progression_Documents/FCD/4FCD1-1
%% 4-XML-2002-03.txt
%% 
%% Go for it.
%% 
%% -- 
%% Peter Eisentraut   peter_e@gmx.net
%% 
%% 
%% ---------------------------(end of broadcast)---------------------------
%% TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
%% 


Wed, 5 Mar 2003 19:05:38 -0500
"Bob Calco" <robert.calco@verizon.net>
Re: XML ouput for psql
* Merlin Moncure <merlin.moncure@rcsonline.com> [2003-03-05 10:02]:

> > Acually, the difficult part has been getting the information back
> > into the database. Getting it out is a very simple query. I imagine
> > that every language/environment has an SQL->XML library somewhere,
> > but I wasn't able to find something that would go from XML to SQL.

> XSLT could be used to convert virtually any xml table format directly
> into an insert statement.  For me, this is better than using a
> programming language plus a parser.  XSLT is quite powerful and fast and
> is build on top of xpath, and is a closer fit to the declarative
> programming model of sql.  Validation could be done at the xslt stage or
> with schemas, which I prefer.

XSLT, or Perl, or anything. That's not a problem. It becomes a
problem when I have to hand write insert/update statements for every
type of element in an XML document.

<person>
  <first-name>Alan</first-name>
  <last-name>Gutierrez</last-name>
  <ssn>1234565789</ssn>
</person>

If I feed this document to a database I want it to absorb the
document, inserting if doesn't already exists, updating it if it
does. There is no way to test for the existstence of a record in a
person table during an XSLT transformation.

-- 
Alan Gutierrez - ajglist@izzy.net
http://khtml-win32.sourceforge.net/ - KHTML on Windows

Wed, 5 Mar 2003 21:53:35 -0600
Alan Gutierrez <ajglist@izzy.net>
Re: XML ouput for psql