Hi,
How can I store inline comments in the argument list of a plpgsql function to document complex overloaded functions
withlots of arguments? It seems that PostgreSQL accepts the comments, but strips them as the function gets stored.
I am using PostgreSQL 9.1.2.
+++
CREATE FUNCTION func_test(
-- comment for argument 1
-- quite longish, explaining the details
argument1 TEXT
-- comment for argument 2
-- even more information
, argument2 TEXT
)
RETURNS smallint AS
$BODY$
BEGIN
-- this comment gets stored correctly
RETURN 1;
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
+++
According to the server log file PostgreSQL gets sent all the comments correctly, so it is not the client that already
stripsthe comments.
+++
[...]
statement: CREATE FUNCTION func_test(
-- comment for argument 1
-- quite longish, explaining the details
argument1 TEXT
-- comment for argument 2
-- even more information
, argument2 TEXT
)
RETURNS smallint AS
$BODY$
BEGIN
-- this comment gets stored correctly
RETURN 1;
END;
$BODY$
LANGUAGE plpgsql IMMUTABLE
COST 100;
+++
select func_test('foo', 'bar');
func_test
-----------
1
(1 row)
Best regards,
Ralph