在postgres / postgresql / psql中注释字符/字符? [英] Comment character/characters in postgres / postgresql / psql?

查看:728
本文介绍了在postgres / postgresql / psql中注释字符/字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

postgres中注释的字符是什么?

What's the character for comments in postgres?

SELECT * FROM my_table     # pound  sign produces a syntax error

感谢cababunga,以下方法似乎可行:

Thank you cababunga, the following appears to work:

SELECT * FROM my_table     -- this is my comment

但这不起作用:

\dt jvcurve_thin.jvcurve_results    --  my comment #2

\dt:多余的参数-已忽略

\dt: extra argument "--" ignored

推荐答案

根据PostgreSQL文档,有内联注释和块样式注释。

According to PostgreSQL documentation, there are both the inline and the block style comments.

内联样式:

SELECT 23 AS test  -- this is just a test

样式:

/* The following is a very
 * non-trivial SQL code */
SELECT 42 AS result

这篇关于在postgres / postgresql / psql中注释字符/字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆