在 create function returns as 语句之后,pl/pgsql 中使用的分隔符 $$ 和 ' 有什么区别?

What is the difference between the delimiter $$ and ' used in pl/pgsql after the create function returns as statement?

声明:
CREATE OR REPLACE FUNCTION test123(fstname text) RETURNS text AS $$

CREATE OR REPLACE FUNCTION test123(fstname text) RETURNS text AS '

returns 传递参数时的相同值。那么这两种说法有什么区别呢?

没有区别,因为两者都是可接受的引用形式。使用美元引号的好处是您不需要转义任何内部单引号。

http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-DOLLAR-QUOTING