How to comment out in PostgreSQL?

by giovanny.lueilwitz , in category: PHP Databases , a year ago

How to comment out in PostgreSQL?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by mac , 9 months ago

@giovanny.lueilwitz 

To comment out a line of code in PostgreSQL, you can use the -- symbol. Anything after -- on a line will be treated as a comment, and will not be executed by the PostgreSQL server.


For example:

1
SELECT * FROM users;  -- this is a comment


You can also use /* and */ to comment out multiple lines of code:

1
2
3
4
/*
This is a multi-line comment
It can span multiple lines
*/


Note that these commenting conventions are specific to PostgreSQL, and may not work in other SQL dialects.