What does the "$$" mean in postgresql function? -


create or replace function increment(i integer) returns integer $$         begin                 return + 1;         end; $$ language plpgsql; 

the above code taken postgresql website. not understand why $$ used. have seen @ multiple examples online , none of them explains why used. or necessary?

from manual create function statement:

definition

a string constant defining function; meaning depends on language. can internal function name, path object file, sql command, or text in procedural language.

it helpful use dollar quoting (see section 4.1.2.4) write function definition string, rather normal single quote syntax. without dollar quoting, single quotes or backslashes in function definition must escaped doubling them.

section 4.1.2.4 explains dollar quoting:

a dollar-quoted string constant consists of dollar sign ($), optional "tag" of 0 or more characters, dollar sign, arbitrary sequence of characters makes string content, dollar sign, same tag began dollar quote, , dollar sign. example, here 2 different ways specify string "dianne's horse" using dollar quoting


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -