comments in argument list of plpgsql get stripped?

From: Ralph Graulich <maillist(at)shauny(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: comments in argument list of plpgsql get stripped?
Date: 2012-01-20 17:28:13
Message-ID: 20E4ABC3-DE3C-4882-9E58-9808638976D0@shauny.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

How can I store inline comments in the argument list of a plpgsql function to document complex overloaded functions with lots 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 strips the 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brice Maron 2012-01-20 18:26:16 Re: Immutable function with bind value
Previous Message Edison So 2012-01-20 16:01:37 PGbouncer for Windows 2008