Positional Parameters#
Used in function definitions and prepared queries to reference values supplied externally to an SQL statement.
Are of the form $number e.g.
mydb=> CREATE FUNCTION sum_modulo_n(a int, b int, n int DEFAULT 10) RETURNS int AS
mydb-> 'SELECT ($1 + $2) % $3' LANGUAGE SQL; -- function body with positional params
mydb=> SELECT sum_modulo_n(1, 2), sum_modulo_n(1, 2, 3);
sum_modulo_n | sum_modulo_n
--------------+--------------
3 | 0
(1 row)