On 10/18/15 10:16 PM, Tom Lane wrote:
> Jim Nasby <Jim.Nasby@BlueTreble.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 $$;
Yeah, I assumed the two were related. We also don't allow NOT NULL. This
is all checked in the production in pl_gram.y, but there's nothing
indicating why this is the case. :/
> 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.
Yeah, was hoping someone knew offhand why this was a problem. Guess I'll
rip the checks out and see what explodes. :)
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com