Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> Is there a particular reason why row and record variables can't be
> CONSTANT in plpgsql?
Well, you can't usefully do anything with such a variable unless
it can be initialized, which isn't currently supported either:
regression=# do $$ declare x int8_tbl := row(1,2); begin end $$;
ERROR: default value for row or record variable is not supported
LINE 1: do $$ declare x int8_tbl := row(1,2); begin end $$;
^
I have a vague recollection of having looked at this a few years
ago and realizing it wasn't quite as trivial as one could wish.
Don't remember why, though. In any case, I'm sure it's fixable
if someone wants to put in enough effort.
regards, tom lane