0

I would like to create a function

 CREATE FUNCTION func(a INT, b DOUBLE PRECISION = 1e-9, c DOUBLE PRECISION = 1e-9)
     RETURNS BOOLEAN
    AS 'MODULE_PATHNAME'
    LANGUAGE C IMMUTABLE STRICT;

How can one determine which arguments were actually passed to the C api?

Can one just use a check like

PG_GETARG_DATUM(1) != NULL

to check if the argument 1 was passed? I am writing the code for postgres >= 9.1

2
  • there are functions PG_ARGISNULL(n), PG_NARGS() Commented Mar 20, 2015 at 11:58
  • In your example b and c will always be actually passed, either with default or explicit values. PG_NARGS is only useful if several Postgres functions share the same C code Commented Mar 20, 2015 at 12:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.