How long does changing PostgreSQL's xmloption setting to DOCUMENT from its default CONTENT last? It seems to be DB wide, not Cluster wide (any way to set it on a column by column basis?)

It seems to be connection specific, which is annoying cause I have a SQL script that needs to have it set to DOCUMENT to pass validation. The script is 24GB uncompressed, so I don't feel like modifying it manually.


it is connection specific,

All plain set commands are. (see the set command in sql refernce)

You can make the setting persistent using.

ALTER[user|database] name SET xmloption TO DOCUMENT ;

see the ALTER command in sql reference

Alternatively you can prepare the session or prepend to the stream being sent to psql, you don't need to edit the actual disk file.

In the following examples everything upto the $ represents the prompt,

Using the psql command-line:

  database-$ SET xmloption TO DOCUMENT ;
  database-$ \i filename 

Or the system commmand-line

~$ psql "conmnection-parameters" -c "SET xmloption TO DOCUMENT" -f "filename"

  • Thanks! How would I prepare the session with psql? I'm a bit of a newb – user123495 Aug 10 '18 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.