Updated on 2025-10-23 GMT+08:00

Single-Line Comment

By default, the content following "--" is regarded as a single-line comment in a database and syntax parsing is not performed. If the m_format_behavior_compat_options parameter contains the forbid_none_space_comment option, a space must be added after "--", and only the content after the space is considered as a single-line comment.

Example

-- Basic scenario of a single-line comment
m_db=# SET m_format_behavior_compat_options='forbid_none_space_comment';
SET
m_db=# SELECT 'abc' -- 1;
m_db-# ;
 ?column?
----------
 abc
(1 row)

-- Special scenario of a single-line comment
m_db=# select 'a'--;
 ?column?
----------
 a
(1 row)

-- The priority of comments is lower than that of quotation marks.
m_db=# select '-- abc';
 ?column?
----------
 -- abc
(1 row)