[SQL] Howto build a funtion that selects an id or inserts a value

2011-09-23 Thread Andreas
Hi, I'd like to have a function that looks up an id of an item. In case the item doesn't exist in the table yet it should be inserted and the new id should be returned. From the PG docu, I took the merge_db sample and modified it a bit. This works but I'm wondering if INSERT part could be tune

Re: [SQL] a spatial table's bounding box

2011-09-23 Thread Filip Rembiałkowski
2011/9/22 Asli Akarsakarya > > I want to get the extensions of spatial table. Say that there is a spatial > table named 'roads', and a some road geometry inside. I want to fetch the > bounding box (envelope or extension) for that table, that means for all the > roads that it has. > > Accordin

Re: [SQL] help with xpath namespace

2011-09-23 Thread Filip Rembiałkowski
2011/9/22 Brian Sherwood > > select (xpath('/chassis-inventory/chassis/serial-number/text()', >data_xml, >ARRAY[ARRAY['junos', > 'http://xml.juniper.net/junos/9.6R4/junos-chassis']] > )) from xml_test; > > Can anyone suggest how I would go about getting the serial-number wit

[SQL] help with xpath namespace

2011-09-23 Thread Brian Sherwood
I am trying to use xpath to extract some information from a XML document. (if it matters, It's the router config for a Juniper router) I believe I am having problems with the namespace. I am trying to extract the serial-number, but I am not getting anything. Here is the script I have been testing

[SQL] a spatial table's bounding box

2011-09-23 Thread Asli Akarsakarya
Hello,  My question is a basic one for postGIS, I believe. It should have a primitive answer somewhere, but I don't have it.  I want to get the extensions of  spatial table. Say that there is a spatial table named 'roads', and a some road geometry inside. I want to fetch the bounding box (envelo