Обсуждение: procedure to load xml file data in postgesql

Поиск
Список
Период
Сортировка

procedure to load xml file data in postgesql

От
aravind chandu
Дата:
Hello,

            I have to load xml file data into postgresql database table using a stored procedure,but I didn't have any idea how to start it.Can you please help me how to do this.Your suggestion is greatly appreciated.Its very important to me.

Thanks in advance,
Avin.

Вложения

Re: procedure to load xml file data in postgesql

От
Stephane Bortzmeyer
Дата:
On Sat, Jul 26, 2008 at 02:32:05PM -0700,
 aravind chandu <avin_friends@yahoo.com> wrote
 a message of 149 lines which said:

>             I have to load xml file data into postgresql database
>             table using a stored procedure,but I didn't have any
>             idea how to start it.

Well, the problem is much too open to provide any ready-to-use
solution. The way you describe it, it looks like a school
assignment. Is it so?

First, you need to decide what the XML data will look like in
PostgreSQL:

* you can slurp the entire file in a TEXT field (the simplest
solution),

* you can convert it to relational data (the schema conversion is not
obvious because XML data model is hierarchical, not relational, but
this solution will give you "nice" SQL data; your actual data look
quite tabular and therefore will fit well in a relational schema)

* you can use PostgreSQL native XML facilities (I cannot help, I've
never used them).
<http://developer.postgresql.org/pgdocs/postgres/datatype-xml.html>
and <http://developer.postgresql.org/pgdocs/postgres/functions-xml.html>