postgrespro/pg_variables

Suggestion: functions that make use of 'any' pseudotype

decibel opened this issue · 5 comments

Just a suggestion... if you used the 'any' pseudotype (or one of it's variants), you could eliminate a lot of code and allow users to store any arbitrary type that they wanted.

Thank you for the suggestion! Didn't think about it. I will try to implement it.

Thank you for useful links!
I remembered, I tried to use 'any' pseudotype. But I met an issue. If I try to create function:

CREATE FUNCTION pgv_get(package text, name text, strict bool default true)
RETURNS anynonarray
AS 'MODULE_PATHNAME', 'variable_get_any'
LANGUAGE C VOLATILE;

I get the error:

ERROR:  cannot determine result data type
DETAIL:  A function returning a polymorphic type must have at least one polymorphic argument.

And the documentation confirms it.
Do you know how to handle it?

Thank you for your help!
Commited.