Re: Why no CONSTANT for row variables in plpgsql? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Why no CONSTANT for row variables in plpgsql?
Date
Msg-id 654.1445224612@sss.pgh.pa.us
Whole thread Raw
In response to Why no CONSTANT for row variables in plpgsql?  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Responses Re: Why no CONSTANT for row variables in plpgsql?  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-hackers
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 $$;                     ^

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



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Making tab-complete.c easier to maintain
Next
From: Jeff Janes
Date:
Subject: Re: Making tab-complete.c easier to maintain