Postgresql format string

We use the format(string, values ...) function.

The placeholders are %s for a string, %I for an sql identifier and %L for an sql literal.

If you want to refer to a position you can, for example, refer to the second with %2$s with the s referring to the above.

format('hello %s %1$s %s', 'again', 'indeed');

gives you hello again again indeed.


Edit on github
comments powered by Disqus
Click me