473,395 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XML & Postgres Functions

Hi all-

I'm migrating to postgres from the MS SQL Server land, as I can see
a great potential with postgres, I was wondering if anyone has
experimented or started a project with XML inside user defined
functions?

I've seen the contrib/xml shipped with the distro, as I see it's
usefulness, it's not quite what I had in mind (lacks the ablity to
return recordset/table of nodes). Also, the project XpSQL seems
interesting, but still not it.

I'm looking for a solution similar to the OpenXML that MS implements
in their SQL Server. A way to parse XML into a table and/or a temp
table for use inside a function. For example, I would like to
serialize my objects into XML, send them to a postgres function for
saving/updating the relational data inside postgres.

I envision something of the following could be useful:

XML
------
<table>
<row field1="Testing" field2="Testing2" updateflag=1/>
...
<row field1="TestingN" field2="TestingN+2" updateflag=1/>
<table>
UDF
------
create function somefunc(xmldata text)
begin
xmldoc := preparedoc(xmldata);
....
update tablename set
field1=x.field1,
field2=x.field2,
from xmltable(xmldoc, '/table/row[@updateflag=1]') as x
....
preform removedoc(xmldoc);
end;

By using XML & XPath, one could be very creative preforming updates
to the tables via the xml data passed to the function. By having
this functionality, one could have their applications communicate
with XML structures instead of database structures and either side
could change without drastically effecting the other. Also, by have
the application obey XML structures, the database schema is unknown
and therefore essentially hidden from the programmers as they don't
need to be bothered with how the data is actually stored.

While my motivation isn't to hide the database schema from
programmers, but to provide simple method for having applications
send data to the data tier for storage. It's much easier to define
complex object structure in XML and then let the database worry
about storing it relationally.

I'm not sure if I'm missing the point with postgres, but we've been
doing this with MS SQL Server for sometime, while it's not the most
effienct method of sending data to the database, I find it most
elegant from the application side, simplify code and promotes code
reusablity.

Has anyone done this before with postgres, if so could you share
your experiences? Also, if no one has attempted this, does anyone
else share the need for something like this? I'm thinking about
starting this project if there is a greater need out there.
Best Regards,
David
ze**********@jmbsoftware.net


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
0 2736

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jaye Gallagher | last post by:
Hi there, I'm coming from a MS-SQL/MySQL background, and am trying to understand the way Postgres phrases "stored procedure" type stuff. What is mystifying me, in particular, is the fact that...
3
by: N.K. | last post by:
Hi, I've just installed postgres on the Linux server. It is supposed to start automatically which I think it does since I can run an sql stmt right away. When I'm trying to connect from a remote...
7
by: Abdul-Wahid Paterson | last post by:
Hi, I have had a site working for the last 2 years and have had no problems until at the weekend I replace my database server with a newer one. The database migration went like a dream and I had...
5
by: Alex Page | last post by:
I've been trying to extend Postgres and create an enumerated type to represent gender, as a precursor to more complex enumerated types. I've created the C functions for input and output with the...
13
by: Nagib Abi Fadel | last post by:
Is it possible to create a session variable for each user in Postresql ?? Thx
0
by: Kevin Bartz | last post by:
-----Original Message----- From: Kevin Bartz Sent: Monday, August 09, 2004 10:37 AM To: 'mike@thegodshalls.com' Subject: RE: Out of swap space & memory Thanks for your reply, Mike!...
1
by: Manolatos Tilemahos | last post by:
Dear friends, First pls accept my apologies, because I am a new Postgres user, so my questions could be silly. We need to setup a database using UTF-8 encoding, however, by some way, we have...
0
by: Bruno Lavoie | last post by:
Hello, i'm etablishing a naming convention for a new project under postgresql. For tables, sequences, views, that's ok! I used good naming conventions for this in the past and i'll keep these...
3
by: fjm67 | last post by:
I am new to PHP but not so new to Postgres. If someone can either direct me to some howto or even provide me with an example, I would be grateful. I would like to know if it is possible to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.