pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: anderson.ant.oli@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15246: Does not allow an INOUT parameter to receive values when its data type is a user-defined data type.
Date: Mon, 18 Jun 2018 23:06:23 -0400
Message-ID: <12033.1529377583@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwYfUe7r43DC52u6YdDfBRepyT5d3VczcTtXUukE8QRscQ@mail.gmail.com>
References: <152936113475.1444.7277014546852553718@wrigleys.postgresql.org>
	<CAKFQuwYfUe7r43DC52u6YdDfBRepyT5d3VczcTtXUukE8QRscQ@mail.gmail.com>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Mon, Jun 18, 2018 at 3:32 PM, PG Bug reporting form <
> noreply@postgresql.org> wrote:
>> p_my_type.rc_tbl1.co_1 := 1; -- ERRO:  "p_my_type.rc_tbl1.co_1" is
>> not
>> variable unknown !!!!

> Short answer is that you cannot simply assign components of a composite
> type one-at-a-time, you have to build up the full final composite result in
> one expression and assign the result of the expression to the typed
> variable (p_my_type in this instance).​

It's not quite that bad.  IIRC, plpgsql handles only one level of field
assignment, so you could write

	p_my_type.rc_tbl1 := ROW(1, 'Teeeeeeeeeeest');

but not

	p_my_type.rc_tbl1.co_1 := 1;

Improving that --- and also allowing mixed array-element-and-field
assignment, say "p_my_type.rc_tbl1[2].co_1 := 1;" --- has been on the
radar screen for a long time, but nobody has gotten round to it.

I think I might've made it a bit easier as of v11, because it'd no longer
be necessary to implement field assignment in two separate code paths
for "rows" and "records".  But it's still a fair amount of work.

			regards, tom lane




view thread (3+ messages)

Message-ID: <12033.1529377583@sss.pgh.pa.us>
Permalink:  ../12033.1529377583@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12033.1529377583@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, anderson.ant.oli@gmail.com
  Subject: Re: BUG #15246: Does not allow an INOUT parameter to receive values when its data type is a user-defined data type.
  In-Reply-To: <12033.1529377583@sss.pgh.pa.us>
  References: <152936113475.1444.7277014546852553718@wrigleys.postgresql.org> <CAKFQuwYfUe7r43DC52u6YdDfBRepyT5d3VczcTtXUukE8QRscQ@mail.gmail.com> <12033.1529377583@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox