Re: Why no CONSTANT for row variables in plpgsql?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Why no CONSTANT for row variables in plpgsql?
Date: 2015-10-19 03:16:52
Message-ID: 654.1445224612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-10-19 03:58:00 Re: Making tab-complete.c easier to maintain
Previous Message Thomas Munro 2015-10-19 00:31:04 Re: Making tab-complete.c easier to maintain