xmlcomment()

A function for generating an XML comment.

xmlcomment() is a system function which generates an XML comment.

xmlcomment() was added in PostgreSQL 8.3.

Usage

xmlcomment ( text ) → xml

The provided text cannot contain '--' or end with '-'.

Change history

Examples

Basic usage example for xmlcomment():

postgres=# SELECT xmlcomment('foo');
 xmlcomment 
------------
 <!--foo-->
(1 row)

Example of invalid input strings:

postgres=# SELECT xmlcomment('--foo');
ERROR:  invalid XML comment

postgres=# SELECT xmlcomment('foo--bar');
ERROR:  invalid XML comment

postgres=# SELECT xmlcomment('foo-');
ERROR:  invalid XML comment

Categories

System function, XML