Re: [GENERAL] xml-file as foreign table?

2016-05-09 Thread Johann Spies
Thanks Arjen, > def q(v): > return b'"' + v.replace(b'"', b'""') + b'"' > > return b','.join(q(f) for f in fields) + b'\n' > > In the end I also had some other problems with the XML (namespaces), so I > used: > > etree.tostring(element, method='c14n', exclusive=True) > This helped. My code

Re: [GENERAL] xml-file as foreign table?

2016-05-06 Thread Arjen Nienhuis
On Thu, May 5, 2016 at 2:13 PM, Johann Spies wrote: > Dankie Arjen, > > On 29 April 2016 at 07:01, Arjen Nienhuis wrote: > >> >> > The options I am considering is : >> > >> > 1. Unpack the individual records (will be more than 50 million) using >> > something like python with lxml and psycopg2 an

Re: [GENERAL] xml-file as foreign table?

2016-04-28 Thread Arjen Nienhuis
On Apr 28, 2016 14:33, "Johann Spies" wrote: > > I have several large (7GB+) xml files to get into an SQL database. > > The xml-files can contain up to 500 000 subrecords which I want to be able to query in the database. > > They are too large to do something like this: > > > insert into rawxml (x

[GENERAL] xml-file as foreign table?

2016-04-28 Thread Johann Spies
I have several large (7GB+) xml files to get into an SQL database. The xml-files can contain up to 500 000 subrecords which I want to be able to query in the database. They are too large to do something like this: insert into rawxml (xml) select XMLPARSE (DOCUMENT CONVERT_FROM(PG_READ_BINARY_FI

Re: [GENERAL] xml

2015-03-23 Thread Pavel Stehule
2015-03-23 15:09 GMT+01:00 Tom Lane : > Pavel Stehule writes: > > result of xmlagg is not valid xml. > > Really? Either that's a bug, or it's declared wrong. > I was not accurate. "" is not valid xml document - and xpath function doens't like it. postgres=# select xpath('//tag/@x',''::xml); ER

[GENERAL] xml

2015-03-23 Thread Ramesh T
Hi all, SELECT xmlagg(xmlelement( name actor, xmlattributes(first_name) )ORDER BY actor_id,',')from actor; the above code return following result, [image: Inline image 1] Question : i want retrieve result from above XML result like

Re: [GENERAL] xml

2015-03-23 Thread Tom Lane
Pavel Stehule writes: > result of xmlagg is not valid xml. Really? Either that's a bug, or it's declared wrong. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mail

Re: [GENERAL] xml

2015-03-23 Thread Pavel Stehule
2015-03-23 12:40 GMT+01:00 Ramesh T : > Hi all, > SELECT xmlagg(xmlelement( > name actor, xmlattributes(first_name) > )ORDER BY actor_id,',')from actor; > > the above code return following result, > > [image: Inline image 1] > Questio

Re: [GENERAL] {xml}

2014-08-07 Thread David G Johnston
Ramesh T wrote > Hello, > when i ran following query on postgres 9.3, > SELECT xmlagg(xmlelement(name e,part_id||',')) from part; > > result > .. > {xml} > > how to get part_id's..? please let me know .. > advance thanks, > R.. Are you using psql? What version of Pos

[GENERAL] {xml}

2014-08-07 Thread Ramesh T
Hello, when i ran following query on postgres 9.3, SELECT xmlagg(xmlelement(name e,part_id||',')) from part; result .. {xml} how to get part_id's..? please let me know .. advance thanks, R..

Re: [GENERAL] XML validation of whitespace values

2014-05-11 Thread David G Johnston
Tim Kane wrote > clone=# create temp table xml_test (document xml); > CREATE TABLE If you know you need to use xpath on this content then you should do one of the following: SELECT CASE WHEN document IS DOCUMENT THEN xpath(...) ELSE default_value_for_missing_data END; CREATE TABLE xml_test ( doc

Re: [GENERAL] XML validation of whitespace values

2014-05-11 Thread Peter Eisentraut
On 3/14/14, 11:12 AM, Tim Kane wrote: > clone=# select xml_is_well_formed(' '); > xml_is_well_formed > > t > (1 row) > > > clone=# select xpath_exists (‘//test', ' '); > ERROR: could not parse XML document > DETAIL: line 1: Start tag expected, '<' not found There are sev

Re: [GENERAL] xml question

2014-04-28 Thread David G Johnston
David Ekren wrote > I am new to this forum. I need to return the value 1 between the > orientationId tags in this xml string within the function below. I still > get errors. I'm sure I am doing something wrong. Any help would be > appreciated. > > > CREATE FUNCTION Davidxml9(v_clipId integer, v_o

[GENERAL] xml question

2014-04-28 Thread David Ekren
I am new to this forum. I need to return the value 1 between the orientationId tags in this xml string within the function below. I still get errors. I'm sure I am doing something wrong. Any help would be appreciated. CREATE FUNCTION Davidxml9(v_clipId integer, v_orientationId varchar(1024), OU

[GENERAL] XML validation of whitespace values

2014-03-14 Thread Tim Kane
HI all, I’ve had an interesting problem trying to perform an UPDATE based on the results of processing an xpath against a field of type xml. Specifically, my query would fail with: > ERROR: could not parse XML document > DETAIL: line 1: Start tag expected, '<' not found I thought this strange

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-17 Thread Edson Richter
Em 17/12/2012 20:14, Thomas Kellerer escreveu: Edson Richter wrote on 14.12.2012 00:52: I was wondering to create a tool for diagramming and database forward engineering. There are already few tools around. If you know a good diagramming tool able to database diff and forward engineering (wi

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-17 Thread Thomas Kellerer
Edson Richter wrote on 14.12.2012 00:52: I was wondering to create a tool for diagramming and database forward engineering. There are already few tools around. If you know a good diagramming tool able to database diff and forward engineering (with "ALTER ...", not "DROP and CREATE"), I would

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-17 Thread Guillaume Lelarge
On Sun, 2012-12-16 at 22:25 -0200, Edson Richter wrote: > Em 16/12/2012 20:27, Guillaume Lelarge escreveu: > > On Fri, 2012-12-14 at 14:17 -0200, Edson Richter wrote: > >> Em 14/12/2012 12:21, Merlin Moncure escreveu: > >>> On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter > >>> wrote: > Em 13/

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-16 Thread Edson Richter
Em 16/12/2012 20:27, Guillaume Lelarge escreveu: On Fri, 2012-12-14 at 14:17 -0200, Edson Richter wrote: Em 14/12/2012 12:21, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter wrote: Em 13/12/2012 20:10, Merlin Moncure escreveu: [...] *) diagram output should be standar

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-16 Thread Guillaume Lelarge
On Fri, 2012-12-14 at 14:17 -0200, Edson Richter wrote: > Em 14/12/2012 12:21, Merlin Moncure escreveu: > > On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter > > wrote: > >> Em 13/12/2012 20:10, Merlin Moncure escreveu: > >>[...] > > > *) diagram output should be standard html (only) without requir

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-14 Thread Merlin Moncure
On Fri, Dec 14, 2012 at 10:17 AM, Edson Richter wrote: > Em 14/12/2012 12:21, Merlin Moncure escreveu: > >> On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter >> wrote: >>> >>> Em 13/12/2012 20:10, Merlin Moncure escreveu: >>> On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote:

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-14 Thread Atri Sharma
On Fri, Dec 14, 2012 at 9:47 PM, Edson Richter wrote: > Em 14/12/2012 12:21, Merlin Moncure escreveu: > > On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter >> wrote: >> >>> Em 13/12/2012 20:10, Merlin Moncure escreveu: >>> >>> On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter < edsonrich...@hotm

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-14 Thread Edson Richter
Em 14/12/2012 12:21, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter wrote: Em 13/12/2012 20:10, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote: Has anyone created a XML Schema that would represent PostgreSQL database with all (or at le

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-14 Thread Merlin Moncure
On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter wrote: > Em 13/12/2012 20:10, Merlin Moncure escreveu: > >> On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter >> wrote: >>> >>> Has anyone created a XML Schema that would represent PostgreSQL database >>> with all (or at least, major) structures? >> >>

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Edson Richter
Em 13/12/2012 20:10, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote: Has anyone created a XML Schema that would represent PostgreSQL database with all (or at least, major) structures? no -- furthermore, why would you want to? what would be the consumer of this '

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Merlin Moncure
On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote: > Has anyone created a XML Schema that would represent PostgreSQL database > with all (or at least, major) structures? no -- furthermore, why would you want to? what would be the consumer of this 'schema'? merlin -- Sent via pgsql-general

[GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Edson Richter
Has anyone created a XML Schema that would represent PostgreSQL database with all (or at least, major) structures? Thanks, Edson -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] XML indexing

2012-09-27 Thread antony . carvalho
Hi all, Im trying to use the xpath funtion to get xml text nodes with efficiency, than i created an index like :=#create index doc_idx on testxml using btree (((xpath('/book/id/text()', doc))[1]::text));But the index is used just when i want xpath('/book/id/text()', doc). I want to get any text no

[GENERAL] xml performance

2012-08-19 Thread Raju Angani
Hi, I have been looking into Postgres for last 1 month. I was wondering if there is a easy wy to store xml data in Postgres and not have any performance impact. Few properties of the XML doc that are stored in the table 1) Each doc could be 1mb in size. 2) Need to update few attributes with the

[GENERAL] xml, xpath,postgres 9.1

2012-01-23 Thread caracan
Hello everybody, sorry for my english. I need to extract the xml: lat, lon and ele. The xml I have it save on a table (gpx.object_value). For the first two works for me: SELECT (xpath ('//lat ', gpx.object_value)) [i] FROM gpx SELECT (xpath ('//lon ', gpx.object_value)) [i] FROM gpx My question

Re: [GENERAL] XML Encoding problem

2011-02-09 Thread Radosław Smogura
I may write some patch, actually text mode will not be affected, becuase it's text mode, and patch will fail if client encoding is "reacher" then server (one possiblity in this situation is to XML-encode to client encoding, text- rencode to server encoding) But looking at code same thing could o

Re: [GENERAL] XML Encoding problem

2011-02-09 Thread Peter Eisentraut
On mån, 2011-02-07 at 12:44 +0100, rsmogura wrote: > I have test database with UTF-8 encoding. I putted there XML > ЁĄ¡, (U+0401, U+0104, U+00A1). I changed client encoding to > iso8859-2, as the result of select I got > ERROR: character 0xd081 of encoding "UTF8" has no equivalent in > "LAT

[GENERAL] XML Encoding problem

2011-02-07 Thread rsmogura
Hi, I have test database with UTF-8 encoding. I putted there XML ЁĄ¡, (U+0401, U+0104, U+00A1). I changed client encoding to iso8859-2, as the result of select I got ERROR: character 0xd081 of encoding "UTF8" has no equivalent in "LATIN2" Stan SQL:22P05. I should got result with characters e

Re: [GENERAL] XML - DOCTYPE element - documentation suggestion

2010-06-28 Thread Peter Eisentraut
On fre, 2010-06-18 at 02:43 +0800, Craig Ringer wrote: > The xml datatype documentation should probably mention that whole > documents must be loaded with an XMLPARSE(DOCUMENT 'doc_text_here), > they > cannot just be cast from text to xml as happens when you pass an xml > document as text to a para

[GENERAL] XML - DOCTYPE element - documentation suggestion

2010-06-17 Thread Craig Ringer
Hi all I've been working with XML storage in Pg and was puzzled by the fact that Pg appears to refuse to store a document with a DOCTYPE declaration - it was interpreting it as a regular element and rejecting it. This turns out to be because Pg parses XML as a fragment (ie option CONTENT) when ca

Re: [GENERAL] XML index

2010-05-27 Thread Chris Roffler
Changed the create index statement to : USING hash and it seems to work. Any idea why btree does not work ? Thanks Chris On Thu, May 27, 2010 at 3:47 PM, Chris Roffler wrote: > Tried that same thing > > > On Thu, May 27, 2010 at 1:53 PM, Thom Brown wrote: > >> On 27 May 2010 12:22, Chr

Re: [GENERAL] XML index

2010-05-27 Thread Chris Roffler
Tried that same thing On Thu, May 27, 2010 at 1:53 PM, Thom Brown wrote: > On 27 May 2010 12:22, Chris Roffler wrote: > > I have a table with an xml column, created an index as follows: > > CREATE INDEX xml_index > > ON test > > USING btree > > (((xpath('//*/ChangedBy/text()'::text,

Re: [GENERAL] XML index

2010-05-27 Thread Thom Brown
On 27 May 2010 12:22, Chris Roffler wrote: > I have a table with an xml column, created an index as follows: > CREATE INDEX xml_index >   ON test >   USING btree >   (((xpath('//*/ChangedBy/text()'::text, external_attributes))[1]::text)); > And here is my select statement: > Select uuid from t >  

[GENERAL] XML index

2010-05-27 Thread Chris Roffler
I have a table with an xml column, created an index as follows: *CREATE INDEX xml_index* * ON test* * USING btree* * (((xpath('//*/ChangedBy/text()'::text, external_attributes))[1]::text));* And here is my select statement: *Select uuid from t * * where (xpath('//*/ChangedBy/text()', extern

Re: [GENERAL] XML Index again

2010-03-08 Thread Chris Roffler
Yup you are right however I am trying to run benchmarks with the two solutions. The xml solution will give us more flexibility in the future , just in case we do not have attribute/value lists :) On Mon, Mar 8, 2010 at 1:33 PM, Alban Hertroys < dal...@solfertje.student.utwente.nl> wrote: >

Re: [GENERAL] XML Index again

2010-03-08 Thread Alban Hertroys
On 8 Mar 2010, at 13:23, Chris Roffler wrote: > Alban > > thanks for your response. I understand what you are saying . > > >Your previous query wasn't about attributes in any specific position - it > >returned documents that contained >more than zero attributes matching a > >given name. Wh

Re: [GENERAL] XML Index again

2010-03-08 Thread Chris Roffler
Alban thanks for your response. I understand what you are saying . >Your previous query wasn't about attributes in any specific position - it returned documents that contained >more than zero attributes matching a given name. What are you trying to do this time? And that is exactly my proble

Re: [GENERAL] XML Index again

2010-03-08 Thread Alban Hertroys
On 8 Mar 2010, at 11:39, Chris Roffler wrote: > Alban > > Thanks for your help, your suggestion worked. > > I need another xpath expression to find any Attribute with Name ="" > under the Attributes node. (not just if it is in a specific position) > see query below. > How do I create an

Re: [GENERAL] XML Index again

2010-03-08 Thread Alban Hertroys
On 8 Mar 2010, at 11:39, Chris Roffler wrote: > Alban > > Thanks for your help, your suggestion worked. > > I need another xpath expression to find any Attribute with Name ="" > under the Attributes node. (not just if it is in a specific position) > see query below. Your previous query

Re: [GENERAL] XML Index again

2010-03-08 Thread Chris Roffler
Alban Thanks for your help, your suggestion worked. I need another xpath expression to find any Attribute with Name ="" under the Attributes node. (not just if it is in a specific position) see query below. How do I create an index for this xpath expression ? Thanks Chris SELECT * FROM

Re: [GENERAL] XML Index again

2010-03-07 Thread Chris
Alban thanks for your replay. Yes I am looking for node exists ... I'll give it a roll. >There are a couple of cases where Postgres won't use your index, but in this >case it's quite clearly because you're asking for (quite) a different >expression than the one you indexed. > >You seem to wa

Re: [GENERAL] XML Index again

2010-03-07 Thread Alban Hertroys
On 7 Mar 2010, at 11:02, Chris Roffler wrote: > I still have some problems with my xml index > > CREATE INDEX xml_index > ON time_series > USING btree > (( > (xpath('/AttributeList/Attributes/Attribute/Name/text()', > external_attributes))[1]::text)); > > When I run the following query

[GENERAL] XML Index again

2010-03-07 Thread Chris Roffler
I still have some problems with my xml index CREATE INDEX xml_index ON time_series USING btree (( (xpath('/AttributeList/Attributes/Attribute/Name/text()', external_attributes))[1]::text)); When I run the following query the index is not used : select id from time_series where array_uppe

Re: [GENERAL] XML performance tuning

2010-03-06 Thread Bruce Momjian
Chris Roffler wrote: > Are there any guidelines for XML performance tuning ? Uh, no, I have never seen any. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com PG East: http://www.enterprisedb.com/community/nav-pg-east-2010.do --

[GENERAL] XML performance tuning

2010-03-05 Thread Chris Roffler
Are there any guidelines for XML performance tuning ? Thanks Chris

Re: [GENERAL] XML Type validates against xml schema?

2010-01-06 Thread Peter Eisentraut
On tis, 2010-01-05 at 16:06 -0800, Andrew Lardinois wrote: > Poking around in the 8.5 Devel Documentation section 8.13.1, the XML > Type, I noticed that: > > "The xml type does not validate input values against a document type > declaration (DTD), even when the input value specifies a DTD" > > I

[GENERAL] XML Type validates against xml schema?

2010-01-05 Thread Andrew Lardinois
Poking around in the 8.5 Devel Documentation section 8.13.1, the XML Type, I noticed that: "The xml type does not validate input values against a document type declaration (DTD), even when the input value specifies a DTD" I suppose the same is true in the case that the XML should validate agains

Re: [GENERAL] xml import/export tools and performance

2009-11-06 Thread John R Pierce
Ivan Sergio Borgonovo wrote: I know one of the exporting parties will be a MS SQL 2005 server, so it would be nice if there was an easy way to import xml generated with the FOR XML AUTO, XMLSCHEMA ('forpg'). Microsoft SQL Server has a pretty good data translation tool, it used to be called

Re: [GENERAL] xml import/export tools and performance

2009-11-06 Thread Brian Modra
2009/11/6 Ivan Sergio Borgonovo : > I need to import/export through xml files. > > I was looking for tools/examples/HOWTO for postgresql. > > Right now I still don't know the details of the requirements. > > I know I won't need a GUI. > > I know one of the exporting parties will be a MS SQL 2005 se

[GENERAL] xml import/export tools and performance

2009-11-05 Thread Ivan Sergio Borgonovo
I need to import/export through xml files. I was looking for tools/examples/HOWTO for postgresql. Right now I still don't know the details of the requirements. I know I won't need a GUI. I know one of the exporting parties will be a MS SQL 2005 server, so it would be nice if there was an easy w

Re: [GENERAL] xml to string, ascii x utf8 conversion

2009-07-21 Thread Peter Eisentraut
On Monday 20 July 2009 19:46:01 Radek Novotný wrote: > query_to_xml('select Nazev as "TITLE", Datum as "DATE", Autor_Akce as "meta > rel=''action_author''", > > gave me > > http://www.w3.org/2001/XMLSchema-instance";> > > Test > 2009-07-20 > test > > > How can i transcode this well gen

[GENERAL] xml to string, ascii x utf8 conversion

2009-07-20 Thread Radek Novotný
Hello, having problem with conversion while doing function query_to_xml. query_to_xml('select Nazev as "TITLE", Datum as "DATE", Autor_Akce as "meta rel=''action_author''", gave me http://www.w3.org/2001/XMLSchema-instance";> Test 2009-07-20 test How can i transcode this well gen

Re: [GENERAL] XML import with DTD

2009-07-11 Thread Roy Walter
Doh! That's it. Thanks a million. -- Roy Tom Lane wrote: Roy Walter writes: This one does not: INSERT INTO wms_collection (docxml) VALUES (XMLPARSE(content( ' ]> Shoes '))) What I know about XML wouldn't fill a thimble, but shouldn't you

Re: [GENERAL] XML import with DTD

2009-07-11 Thread Tom Lane
Roy Walter writes: > This one does not: > INSERT INTO wms_collection (docxml) VALUES (XMLPARSE(content( > ' > [ > > > ]> > > Shoes > '))) What I know about XML wouldn't fill a thimble, but shouldn't you say DOCUMENT not CONTENT if you are trying to pro

Re: [GENERAL] XML import with DTD

2009-07-11 Thread Roy Walter
rser error : StartTag: invalid element name -- Roy arta...@comcast.net wrote: Post a snippet of the xml and xpath you are trying to use. Scott - Original Message - From: "Roy Walter" To: pgsql-general@postgresql.org Sent: Friday, July 10, 2009 7:49:00 AM GMT -08:00 US/C

Re: [GENERAL] XML import with DTD

2009-07-10 Thread artacus
Post a snippet of the xml and xpath you are trying to use. Scott - Original Message - From: "Roy Walter" To: pgsql-general@postgresql.org Sent: Friday, July 10, 2009 7:49:00 AM GMT -08:00 US/Canada Pacific Subject: [GENERAL] XML import with DTD Hi I'm trying t

[GENERAL] XML import with DTD

2009-07-10 Thread Roy Walter
Hi I'm trying to use the XPath functionality of Postgres. I can populate a text field (unparsed) with XML data but as far as I can see the xpath() function [now] only works on the xml data type. When I try to populate a text field with XML data containing a DTD, however, the parser chokes. I

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-07 Thread Grzegorz Jaśkiewicz
I can test/review the code, if you want. It would be a nice thing to have in postgresql, obviously once you prepare statement enough to convince Tom :) XSLT is a necessity , otherwise it won't be standard, and thus - quite useless. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-07 Thread Peter Eisentraut
On Monday 01 June 2009 12:53:08 Grzegorz Jaśkiewicz wrote: > is there any way currently to convert xml file in format like below, > to a table ? I have some code that does this, but it was written a long time ago and will probably need some polishing. One main problem is how you specify that exa

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Scott Bailey
Pavel Stehule wrote: 2009/6/1 Grzegorz Jaśkiewicz : That's one of things pg xml type lacks ... :/ yes - SQL/XML isn't completed yet http://wiki.postgresql.org/wiki/XML_Support :( I believe so some procedure like xml_to_table should be nice. but plperlu code should be simple (as perl code sh

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Pavel Stehule
2009/6/1 Grzegorz Jaśkiewicz : > That's one of things pg xml type lacks ... :/ yes - SQL/XML isn't completed yet http://wiki.postgresql.org/wiki/XML_Support :( I believe so some procedure like xml_to_table should be nice. but plperlu code should be simple (as perl code should be :)) and fast

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
That's one of things pg xml type lacks ... :/ I just need that to get some real xml, and convert to table once, so I should be fine with xpath, but ... heh. This is so ugly. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.post

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Pavel Stehule
Hello you can use simple perl parser an sample is on http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl#Generov.C3.A1n.C3.AD.2C_zpracov.C3.A1n.C3.AD_XML code is in english and perl, description in czech, sorry regards Pavel Stehule 2009/6/1 Grzegorz Jaśkiewicz : > xpath is fine, but no

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Sam Mason
On Mon, Jun 01, 2009 at 11:22:14AM +0100, Grzegorz Jaaakiewicz wrote: > xpath is fine, but not when you have 10+ fields to extract ;) I've got a few views pulling 10 to 15 values out of XML files and it works OK, not amazing performance but for what I'm doing it's no problem. Scaling beyond that

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
xpath is fine, but not when you have 10+ fields to extract ;) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Sam Mason
On Mon, Jun 01, 2009 at 10:53:08AM +0100, Grzegorz Jaaakiewicz wrote: > is there any way currently to convert xml file in format like below, > to a table ? I've had good luck with the xpath support in PG[1] and some variant of the "unnest" function that's in PG 8.4 (various versions[2] have been p

[GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
is there any way currently to convert xml file in format like below, to a table ? ... ... ... -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Ries van Twisk
On May 6, 2009, at 4:16 PM, Eric Schwarzenbach wrote: Gauthier, Dave wrote: Is there a way to read an XML file into a postgres DB? I’m thinking that it will create and relate whatever tables are necessary to reflect whatever’s implied by the XML file structure. Thanks for any pointers !

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread John R Pierce
Gauthier, Dave wrote: Is there a way to read an XML file into a postgres DB? I’m thinking that it will create and relate whatever tables are necessary to reflect whatever’s implied by the XML file structure. Thanks for any pointers ! As others have said, the fundamental problem is that ge

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Eric Schwarzenbach
Gauthier, Dave wrote: > > Is there a way to read an XML file into a postgres DB? I’m thinking > that it will create and relate whatever tables are necessary to > reflect whatever’s implied by the XML file structure. > > > > Thanks for any pointers ! > That's a pretty common problem, and not one

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Joao Ferreira
On Wed, 2009-05-06 at 16:53 +0100, Joao Ferreira gmail wrote: > hello, > > as a perl addict I am... I recommend checking this out: > > http://search.cpan.org/~cmungall/DBIx-DBStag/DBIx/DBStag/Cookbook.pm > > it's pretty flexible and allows you to specify to some extent just how > the database st

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Thomas Kellerer
Gauthier, Dave, 06.05.2009 17:40: Maybe... EMP EMP_NAME="FRANK" JOB="PLUMBER"/> EMP EMP_NAME="SUE" JOB="CARPENTER"/> ...equals... create table employees (emp_name varchar[64], job varchar[64]); create table jobs (job_name varchar[64], salary float); insert

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Joao Ferreira gmail
On Wed, 2009-05-06 at 16:53 +0100, Joao Ferreira gmail wrote: > hello, > > as a perl addict I am... I recommend checking this out: > > http://search.cpan.org/~cmungall/DBIx-DBStag/DBIx/DBStag/Cookbook.pm > > it's pretty flexible and allows you to specify to some extent just how > the database st

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Joao Ferreira gmail
hello, as a perl addict I am... I recommend checking this out: http://search.cpan.org/~cmungall/DBIx-DBStag/DBIx/DBStag/Cookbook.pm it's pretty flexible and allows you to specify to some extent just how the database structure is infered from the XML... check it out Joao On Wed, 2009-05-06

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Gauthier, Dave
("CARPENTER",25.50); insert into jobs (job_name,salary) values ("PLUMBER",28.75); After that, it's up to the user to understand that employees.job = jobs.job_name and index appropriately. -Original Message- From: Merlin Moncure [mailto:mmonc...@gmail.com] Se

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Christophe
On May 6, 2009, at 10:47 AM, Gauthier, Dave wrote: Is there a way to read an XML file into a postgres DB? I’m thinking that it will create and relate whatever tables are necessary to reflect whatever’s implied by the XML file structure. There's no built-in functionality that does what you

Re: [GENERAL] XML -> PG ?

2009-05-06 Thread Merlin Moncure
On Wed, May 6, 2009 at 10:47 AM, Gauthier, Dave wrote: > Is there a way to read an XML file into a postgres DB?  I’m thinking that it > will create and relate whatever tables are necessary to reflect whatever’s > implied by the XML file structure. since xml is basically completely unstructured, y

[GENERAL] XML -> PG ?

2009-05-06 Thread Gauthier, Dave
Is there a way to read an XML file into a postgres DB? I'm thinking that it will create and relate whatever tables are necessary to reflect whatever's implied by the XML file structure. Thanks for any pointers !

[GENERAL] xml not enabled by default on rhel4 packages from commandprompt

2009-05-01 Thread Grzegorz Jaśkiewicz
Any idea why xml support is off ? The libxml2, version 2.6.23 is there on centos4.7 (which is what I am using), is there any known problem with xml that it is off, or is just because they wanted to make sure that the package is going to work in versions prior to 4.7 as well ?? any ideas ? -- GJ

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Peter Eisentraut
Jef Peeraer wrote: it would be a flag to indicate no conversion from the datestyle settings in the database...i think, from a users perspective, the table_to_xml is completely useless, if you have to reformat everything afterwards Just write a function that does your formatting afterwards.

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Pavel Stehule
2008/9/11 Jef Peeraer <[EMAIL PROTECTED]>: > > > On Thu, 11 Sep 2008, Peter Eisentraut wrote: > >> Jef Peeraer wrote: >> > >> > On Thu, 11 Sep 2008, Peter Eisentraut wrote: >> > >> > > Tom Lane wrote: >> > > > Jef Peeraer <[EMAIL PROTECTED]> writes: >> > > > > i am using the xml add-ons, but the da

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Jef Peeraer
On Thu, 11 Sep 2008, Peter Eisentraut wrote: > Jef Peeraer wrote: > > > > On Thu, 11 Sep 2008, Peter Eisentraut wrote: > > > > > Tom Lane wrote: > > > > Jef Peeraer <[EMAIL PROTECTED]> writes: > > > > > i am using the xml add-ons, but the date output format seems to be > > > > > wrong : > > >

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Peter Eisentraut
Jef Peeraer wrote: On Thu, 11 Sep 2008, Peter Eisentraut wrote: Tom Lane wrote: Jef Peeraer <[EMAIL PROTECTED]> writes: i am using the xml add-ons, but the date output format seems to be wrong : I think the conversion to xml intentionally always uses ISO date format, because that's required

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Pavel Stehule
2008/9/11 Jef Peeraer <[EMAIL PROTECTED]>: > > > On Thu, 11 Sep 2008, Peter Eisentraut wrote: > >> Tom Lane wrote: >> > Jef Peeraer <[EMAIL PROTECTED]> writes: >> > > i am using the xml add-ons, but the date output format seems to be wrong >> > > : >> > >> > I think the conversion to xml intention

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Jef Peeraer
On Thu, 11 Sep 2008, Peter Eisentraut wrote: > Tom Lane wrote: > > Jef Peeraer <[EMAIL PROTECTED]> writes: > > > i am using the xml add-ons, but the date output format seems to be wrong : > > > > I think the conversion to xml intentionally always uses ISO date format, > > because that's require

Re: [GENERAL] xml queries & date format

2008-09-11 Thread Peter Eisentraut
Tom Lane wrote: Jef Peeraer <[EMAIL PROTECTED]> writes: i am using the xml add-ons, but the date output format seems to be wrong : I think the conversion to xml intentionally always uses ISO date format, because that's required by some spec somewhere. Yes, it follows XML Schema. Which is wh

Re: [GENERAL] xml queries & date format

2008-09-05 Thread Tom Lane
Jef Peeraer <[EMAIL PROTECTED]> writes: > i am using the xml add-ons, but the date output format seems to be wrong : I think the conversion to xml intentionally always uses ISO date format, because that's required by some spec somewhere. regards, tom lane -- Sent via pgs

[GENERAL] xml queries & date format

2008-09-05 Thread Jef Peeraer
i am using the xml add-ons, but the date output format seems to be wrong : i have show datestyle; DateStyle --- SQL, DMY select agenda_datum from dossiers where id = 61; agenda_datum -- 29/07/2008 select table_to_xml('dossiers', false, false, ''); gives (knip ) 62

Re: [GENERAL] xml and postgresql

2008-07-04 Thread William Leite Araújo
On Fri, Jul 4, 2008 at 11:01 AM, Gwyneth Morrison <[EMAIL PROTECTED]> wrote: > aravind chandu wrote: > > Hi folks, > > I need to load xml data in to database can you tell me they > way how do I import xml data into postgresql database. > > lets dat this is the xml file > > > > >

Re: [GENERAL] xml and postgresql

2008-07-04 Thread Gwyneth Morrison
aravind chandu wrote: Hi folks, I need to load xml data in to database can you tell me they way how do I import xml data into postgresql database. lets dat this is the xml file Harry Potter J K. Rowling 2005 29

[GENERAL] xml and postgresql

2008-07-03 Thread aravind chandu
Hi folks, I need to load xml data in to database can you tell me they way how do I import xml data into postgresql database. lets dat this is the xml file Harry Potter J K. Rowling 2005 29.99 Learning XML Erik T. Ray 2003 39.95 so finally the tab

Re: [GENERAL] XML output & multiple SELECT queries

2008-06-15 Thread Peter Eisentraut
Peter Billen wrote: > I would like to ask a question about outputting data as XML. Say I have two > tables: > > team(integer id, text name); > player_of_team(integer id, integer team_id, text name); (team_id is FK to > team.id) > > I would like to query both tables to get following example XML outp

[GENERAL] XML output & multiple SELECT queries

2008-06-14 Thread Peter Billen
Dear PostgreSQL users, I would like to ask a question about outputting data as XML. Say I have two tables: team(integer id, text name); player_of_team(integer id, integer team_id, text name); (team_id is FK to team.id) I would like to query both tables to get following example XML output:

Re: [GENERAL] XML Support related questions

2008-05-27 Thread Peter Eisentraut
Brijesh Shrivastav wrote: > For #4 I was looking to be able to index some or all of the tags in the > xml document. Most of our applications query very few tags in a Xml > document > and a smaller index on few tags will help with query performance. Expression indexes on xpath are probably what you

Re: [GENERAL] XML Support related questions

2008-05-24 Thread Peter Eisentraut
Am Donnerstag, 22. Mai 2008 schrieb Brijesh Shrivastav: > 1) Can xml column be constrained to be DOCUMENT or CONTENT type? Using a check constraint that does IS [NOT] DOCUMENT on the value. > 2) Is there plan in near future to support XML schema validation > i.e to ensure inserted xml d

  1   2   >