开发者

what is the difference

开发者 https://www.devze.com 2022-12-26 03:39 出处:网络
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:

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

精彩评论

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