0

I'm using Postgres 9.5.

This is my Postgres Table.

create table testXml(XmlFile xml);

I have an XML file in my local Folder.

<?xml version="1.0" ?><Student><Id>1</Id><Marks>275</Marks><Rank>2</Rank></Student>

I want insert the file into my table. I can able to insert the file when it located in the data directory.

I found an alternate way but it returns OID value:

SELECT lo_import('/home/dinesh/Desktop/test.xml');

When runs this, it gives the result : 17994

But I need the XML value as my result.

I can't able to find a clear solution to convert the OID to XML value.

Please help me to get the correct result.

Thanks in Advice.

2
  • 1
    I think the answer to your question can be found here: stackoverflow.com/questions/16048649/… Commented Mar 8, 2016 at 14:01
  • You can't use lo_import with the xml type (and lo_import can only access files on the server anyway). Commented Mar 8, 2016 at 14:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.