开发者

what is the difference

I'm not even sure what this is called?

But I'm trying to learn what the difference is between writing a function like this is in plpgsql:

CREATE OR REPLACE FUNCTION foo() RETURNS TRIGGER AS $$
    ....
$$ LANGUAGE plpgsql;

vs

CREATE OR REPLACE FUNCTION foo() RETURNS TRIGGER AS $foo$
    ....
$foo$ LANGUAGE plpgsql;

is there a difference when using $$ vs $foo$? why would someone choose one over another? perhaps I've just missed some documentation explaining the d开发者_如何学运维ifference. If someone could enlighten me, I'd really appreciate it.


Whatever you type between the $ signs after the AS becomes the delimiter tag. You could write:

CREATE OR REPLACE FUNCTION foo() RETURNS TRIGGER AS $!!unicorns!!$
    ....
$!!unicorns!!$ LANGUAGE plpgsql;

The $...$ notation denotes a dollar-quoted string constant in PostgreSQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜