Recover domains with sql query in a postgresql geodatabase

376
1
08-16-2018 05:06 PM
Highlighted
New Contributor

Hi, I need to create this Oracle script in Postgresql, I do not have experience in xml and I need to list all the domains in a query, but in a Postgresql geodatabase. The query below it works in a Oracle Geodatabase. Thanks.  Carlos Rodriguez

 

SELECT items.Name NOMBRE_DOMINIO,
itemtypes.Name TIPO_DOMINIO,
EXTRACTVALUE (CodedValues.COLUMN_VALUE, 'CodedValue/Code') AS CODIGO_DOMINIO,
EXTRACTVALUE (CodedValues.COLUMN_VALUE, 'CodedValue/Name') AS DESCRIPCION_DOMINIO
FROM SDE.GDB_ITEMS_VW items INNER JOIN SDE.GDB_ITEMTYPES itemtypes
ON items.TYPE = itemtypes.UUID,
TABLE (XMLSEQUENCE (XMLType (Definition).EXTRACT ('/GPCodedValueDomain2/CodedValues/CodedValue'))) CodedValue
WHERE itemtypes.Name IN ('Coded Value Domain', 'Range Domain');

Reply
0 Kudos
1 Reply
Highlighted
New Contributor
It's work with this script:
SELECT name as domain_name,
unnest(CAST(xpath('//CodedValue/Name/text()',definition) AS text)::text[]) AS description,
unnest(CAST(xpath('//CodedValue/Code/text()',definition) AS text)::text[]) AS code
from sde.gdb_items


Reply
0 Kudos