Re: [GENERAL] xpath functionerror

2014-02-27 Thread sparikh
Thanks David for your quick response. My original objective was to get the value of a particular node in xml which is stored as text datatype in the table. For example : --16 I want to extract the value of amperage as '16'. Like that I may have many nodes in xml want to get the report to show

[GENERAL] xpath functionerror

2014-02-27 Thread sparikh
Hi, My current database version is "PostgreSQL 9.1.11 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3), 64-bit". I am trying to use function xpath in my query and got following error. "ERROR: function xpath(unknown, text) does not exist at character 8 HINT:

Re: [GENERAL] xpath functionerror

2014-02-26 Thread David Johnston
sparikh wrote > Thanks David for your quick response. My original objective was to get the > value of a particular node in xml which is stored as text datatype in the > table. > > For example : > > > > - > > - > > > 16 > > > > > I want to extract the value of amperage as '16'. Like that

Re: [GENERAL] xpath functionerror

2014-02-26 Thread David Johnston
sparikh wrote > Hi, > > My current database version is "PostgreSQL 9.1.11 on > x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat > 4.4.7-3), 64-bit". > > I am trying to use function xpath in my query and got following error. > > "ERROR: function xpath(unknown, text) does

Re: [GENERAL] xpath index not being used

2010-07-18 Thread Craig Ringer
On 19/07/10 05:41, Irooniam wrote: > However, when I check which index it's using, it's not using the xpath > index: > explain select * from test where ((xpath('//names/name[. ="bob"]/text()', > data))[1]::text) = 'bob'; >QUERY > PLAN > -

[GENERAL] xpath index not being used

2010-07-18 Thread Irooniam
Hello, I've searched the mailing list and I tried using defining a xpath index per the post, but my query is still not using it. Essentially, I'm storing a fragment of xml and I want to create xpath indexes on them. The two rows I'm going to insert look like this (alex & bob are the only names r

Re: [GENERAL] Xpath Index in PostgreSQL

2010-03-05 Thread Chris Roffler
Figured it out , thanks for all your help ( had missing brackets ) Here is the sql statement CREATE INDEX xml_index ON time_series USING btree (( (xpath('/AttributeList/Attributes/Attribute/Name/text()', external_attributes))[1]::text)); Thanks Chris On Fri, Mar 5, 2010 at 4:18 PM, Chr

Re: [GENERAL] Xpath Index in PostgreSQL

2010-03-05 Thread Chris Roffler
Thanks for your fast response I have the following sql statement now : CREATE INDEX xml_index ON time_series USING btree (xpath('/AttributeList/Attributes/Attribute/Name/text()',external_attributes))[1]::text And I am getting the following error : ERROR: syntax error at or near "[" LINE 6

Re: [GENERAL] Xpath Index in PostgreSQL

2010-03-05 Thread Tom Lane
Chris Roffler writes: > I am trying to setup an index on an xpath expression but the query never > uses the index. > Could someone enlighten me please ? > Here is the setup : > CREATE INDEX xml_index > ON time_series > USING btree > ((xpath('/AttributeList/Attributes/Attribute/Name/text()'

[GENERAL] Xpath Index in PostgreSQL

2010-03-05 Thread Chris Roffler
I am trying to setup an index on an xpath expression but the query never uses the index. Could someone enlighten me please ? Here is the setup : CREATE TABLE time_series ( id bigint NOT NULL, "name" character varying NOT NULL, "timestamp" timestamp with time zone NOT NULL, start_date time

Re: [GENERAL] xpath

2010-02-11 Thread MOLINA BRAVO FELIPE DE JESUS
try to cast to "xml" xml_payload::xml El mié, 10-02-2010 a las 12:39 +0300, Allan Kamau escribió: > As advised by Peter, > Below is an example (including the ddl and dml statements), it _drops_ > and creates a table called "simple_table" and a sequence called > "simple_table_seq" both in th

Re: [GENERAL] xpath

2010-02-10 Thread Allan Kamau
As advised by Peter, Below is an example (including the ddl and dml statements), it _drops_ and creates a table called "simple_table" and a sequence called "simple_table_seq" both in the "public" schema. DROP SEQUENCE IF EXISTS simple_table_seq CASCADE; CREATE SEQUENCE simple_table_seq; DROP TABLE

Re: [GENERAL] xpath

2010-02-10 Thread Allan Kamau
On Wed, Feb 10, 2010 at 11:34 AM, Otandeka Simon Peter wrote: > Allan, > > Postgres is very strict on variable types and char conversion.  I have a > feeling you are trying to access data from a varchar feild using an > integer... > > Can you paste here your schema for that table? > > P. > > On We

Re: [GENERAL] xpath

2010-02-10 Thread Otandeka Simon Peter
Allan, Postgres is very strict on variable types and char conversion. I have a feeling you are trying to access data from a varchar feild using an integer... Can you paste here your schema for that table? P. On Wed, Feb 10, 2010 at 11:06 AM, Allan Kamau wrote: > Hi, > I am running postgreSQL

[GENERAL] xpath

2010-02-10 Thread Allan Kamau
Hi, I am running postgreSQL-8.4.2. I have a table that stores a single xml document per row in one of it's fields. I would like to use xpath to retrieve portions of these xml documents. Is there a way to do so. (I am running postgreSQL 8.4.2 configured (built) with --with-libxml and --with-libxslt

Re: [GENERAL] XPath PostgreSQL 8.4

2009-10-17 Thread Tim Landscheidt
I wrote: > [...] > You have to put brackets around the function call: > | select (xpath('/trade/trade-info/id/text()', cast(xml as xml)))[1] as id > from risk.trade_table; ... or, after a look in the dictionary, whatever you call "(" and ")" :-). Tim -- Sent via pgsql-general mailing list (

Re: [GENERAL] XPath PostgreSQL 8.4

2009-10-17 Thread Tim Landscheidt
Karl Koster wrote: > It looks like I have to abandon xml2 functions in PostgreSQL > 8.4. The problem is I can't seem to find an incantation of > xpath that will perform the same thing. I have tried the > following snippet: > select xpath('/trade/trade-info/id/text()', cast(xml as > xml))[1] as i

[GENERAL] XPath PostgreSQL 8.4

2009-10-17 Thread Karl Koster
It looks like I have to abandon xml2 functions in PostgreSQL 8.4. The problem is I can't seem to find an incantation of xpath that will perform the same thing. I have tried the following snippet: select xpath('/trade/trade-info/id/text()', cast(xml as xml))[1] as id from risk.trade_table whi

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Sam Mason wrote: On Sun, Jul 12, 2009 at 09:49:15PM +0100, Roy Walter wrote: Where exactly does that fit in terms of my original query, i.e.: SELECT x FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml) AS x FROM docs) AS y WHERE x <> [test for empty array?

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
On Sun, Jul 12, 2009 at 09:49:15PM +0100, Roy Walter wrote: > Where exactly does that fit in terms of my original query, i.e.: > >SELECT x >FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml) >AS x FROM docs) AS y WHERE x <> [test for empty array?] Something

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]): ERROR: synta

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: > Scott Bailey wrote: > >Roy Walter wrote: > >>How do I test for an empty array in postgres? > > > >WHERE x != array[]::xml[] > > > > > Thanks Scott but that throws up a syntax error (at the closing bracket > of array[]): > >ERROR:

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Roy Walter wrote: In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The d

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Roy Walter wrote: In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The documentation states:

[GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The documentation states: The function |x

Re: [GENERAL] xpath functions

2009-02-21 Thread Peter Eisentraut
On Thursday 19 February 2009 16:46:42 Francisco wrote: > Hi List, > I have installed postgreSQL 8.3 in my Ubuntu Hardy Heron. > I want to use xpath functions (like xpath_table), but I can't. An error > appears "xpath_table does not exists". > How could I intregrate xpath funtions with my postgreSQL

Re: [GENERAL] xpath functions

2009-02-20 Thread Francisco
I have executed pg_config and I have the libxml. I think the problem is that xml2 is not enabled, any idea how to enable it? 2009/2/19 Osvaldo Kussama > 2009/2/19 Francisco : > > I saw it,but it says: > > "Use of many of these functions requires the installation to have been > built > > with con

Re: [GENERAL] xpath functions

2009-02-19 Thread Francisco
I saw it,but it says: "Use of many of these functions requires the installation to have been built with configure --with-libxml" When I installed postgreSQL I did not include this option, have I to reinstall postgresql? 2009/2/19 Osvaldo Kussama > 2009/2/19 Francisco : > > Hi List, > > I have i

[GENERAL] xpath functions

2009-02-19 Thread Francisco
Hi List, I have installed postgreSQL 8.3 in my Ubuntu Hardy Heron. I want to use xpath functions (like xpath_table), but I can't. An error appears "xpath_table does not exists". How could I intregrate xpath funtions with my postgreSQL without reinstalling it? Any solution? Thanks ;)

[GENERAL] XPath to search for elements in a sequence

2009-01-13 Thread Brad Balmer
With XML similar to: < a > < b > < c > 1 < c > 2 < c > 3 I'm trying to create an xpath expression (for a postgresql query) that will return if is a particular value and not that is all three values. What I currently have (which does not work) is: select * from someTable where xpat

Re: [GENERAL] xpath and xml namespaces

2007-03-04 Thread Nikolay Samokhvalov
On 3/4/07, Peter Schonefeld <[EMAIL PROTECTED]> wrote: Hi, i'm having trouble getting xpath in Postgres 8.2 to recognise xml namespaces...could someone please point me to a good reference for the xml2 lib? This is FAQ-like question. The thing is that XPath spec doesn't define any default mappin

[GENERAL] xpath and xml namespaces

2007-03-04 Thread Peter Schonefeld
Hi, i'm having trouble getting xpath in Postgres 8.2 to recognise xml namespaces...could someone please point me to a good reference for the xml2 lib? Cheers Pete

Re: [GENERAL] XPath and XML support

2006-08-30 Thread Dave Page
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of John Gray > Sent: 29 August 2006 22:49 > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] XPath and XML support > > On Thu, 24 Aug 2006 13:56:12 -0700, Frank Co

Re: [GENERAL] XPath and XML support

2006-08-29 Thread John Gray
On Thu, 24 Aug 2006 13:56:12 -0700, Frank Cohen wrote: > Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet > makes me wonder if this is going to be the best way to use XML in > PostgreSQL in the long-term? Is there anything else on the boards? - > Frank > There's a lot of sco

Re: [GENERAL] XPath and XML support

2006-08-24 Thread Frank Cohen
Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet makes me wonder if this is going to be the best way to use XML in PostgreSQL in the long-term? Is there anything else on the boards? - Frank On Aug 24, 2006, at 4:17 AM, Nikolay Samokhvalov wrote: On 8/24/06, Jeff Davis <[E

Re: [GENERAL] XPath and XML support

2006-08-24 Thread Nikolay Samokhvalov
On 8/24/06, Jeff Davis <[EMAIL PROTECTED]> wrote: On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote: > > These look like good XPath functions. Are they actually in PSQL > 8.1.4? I did not find them in the Windows installed version. If not, > are they recommended? Look at contrib/xml2. The fun

Re: [GENERAL] XPath and XML support

2006-08-23 Thread Jeff Davis
On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote: > I'm doing a performance and scalability test project for a PostgreSQL > user who is working with geospatial data. The data is in GML form. > For instance: > > > > > >http://www.opengis.net/gml";> > 7.0,9.0 > > > > > >

[GENERAL] XPath and XML support

2006-08-23 Thread Frank Cohen
I'm doing a performance and scalability test project for a PostgreSQL user who is working with geospatial data. The data is in GML form. For instance: http://www.opengis.net/gml";> 7.0,9.0 I installed PostGIS and it supports Point and coordinates very well. I an not sure wha

Re: [GENERAL] XPath question - big trouble

2006-08-08 Thread Csaba Nagy
> Since you brought up the subject, will this > //[EMAIL PROTECTED] = "02"] > be slower than > /mydocument/body/chapter/contents/[EMAIL PROTECTED] > >> = "02"] > when handling a big document? > I mean from the query time point of view ... I have no idea about the postgres XML implementation int

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Marian POPESCU
Thank you! Since you brought up the subject, will this //[EMAIL PROTECTED] = "02"] be slower than /mydocument/body/chapter/contents/[EMAIL PROTECTED] >> = "02"] when handling a big document? I mean from the query time point of view ... Csaba Nagy wrote: > Marian, > >> 1. >> SELECT >>

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Csaba Nagy
Marian, > 1. > SELECT > xpath_nodeset(xml_data, '/mydocument/body/chapter/contents/[EMAIL > PROTECTED] > = "02"]|/mydocument/body/[EMAIL PROTECTED]"87"]') > FROM xmltable > WHERE id = 3 You could maybe use the xpath: '//[EMAIL PROTECTED] = "02"]' if you want all paragraphs at all docume

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Marian POPESCU
You are right; I had a typo : contents is content Thanks for replying ... Guy Rouillier wrote: > Marian POPESCU wrote: >> There is also a weird thing: >> >> >> SELECT >> xpath_nodeset(rawdata, >> '/mydocument/body/chapter/contents/paragraph') FROM xmldocuments >> >> will output >> >> xpath

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Marian POPESCU
It looks that I shoot myself in the foot :( CREATE TABLE xmltable ( id int8 NOT NULL, xml_data text, CONSTRAINT pk_xmltable PRIMARY KEY (id) ) WITHOUT OIDS; The id field contains values from 1 to 3. The field xml_data contains something like this: My document

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Csaba Nagy
Marian, On Mon, 2006-08-07 at 17:47, Marian POPESCU wrote: > SELECT > xpath_nodeset(rawdata, '/mydocument/body/chapter/contents/paragraph') > FROM xmldocuments > > will output > > xpath_nodeset > > (empty line) > (empty line) > (emp

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Guy Rouillier
Marian POPESCU wrote: > There is also a weird thing: > > > SELECT > xpath_nodeset(rawdata, > '/mydocument/body/chapter/contents/paragraph') FROM xmldocuments > > will output > > xpath_nodeset > > (empty line) > (empty line) > (empty line) > (empty line) > > 4 record(s

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Marian POPESCU
Thanks for replying. It was a typo ... Also id fom example should be objid ... Anyway, without the typo, the result set is empty. There is also a weird thing: SELECT xpath_nodeset(rawdata, '/mydocument/body/chapter/contents/paragraph') FROM xmldocuments will output xpath_nodeset

Re: [GENERAL] XPath question - big trouble

2006-08-07 Thread Csaba Nagy
[snip] > [snip] > xpath_bool(rawdata,'/mydocument/body/chapter/contents/paragraph[objid="2_1"]'); ^ To me it looks like attribute name mismatch, n

[GENERAL] XPath question - big trouble

2006-08-07 Thread Marian POPESCU
Hello everyone, First of all, thank you for integrating XPath in Postgresql. But, as you will see, this is a desperate cry for help: 1. the actual context: Postgresql 8.1.4, Fedora Core 5 DATABASE = CREATE TABLE xmldocuments ( id int8 NOT NULL, rawdata text, title varchar(255),