[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    =?utf-8?Q?Re=3A_PL/pgSQL=3A_=C2=AB_arr=5Bj=5D=2Ea_=3A=3D_v_=C2=BB?= =?utf-8?Q?_works_fine_in_PG_Vers
From:       Bryn Llewellyn <bryn () yugabyte ! com>
Date:       2022-07-25 18:43:15
Message-ID: 89FDDABB-CF19-4DBF-9C43-B881CA1A5BB2 () yugabyte ! com
[Download RAW message or body]

> david.g.johnston@gmail.com wrote:
> 
> > bryn@yugabyte.com wrote:
> > 
> > I copied my testcase at the end. It runs OK and produces the output that I expect \
> > using PG Version 14.4. But using Version 11.9 (and earlier 11 sub-versions), it \
> > fails to compile with this error: 
> > syntax error at or near "."
> > lhs[j].a := rhs[j].a;
> > ^
> > 
> > If I comment out the "Ideal approach" loop, then it runs fine in PG 11 and \
> > produces the same output as the "Ideal approach" does in PG 14, 
> > I looked at the Release Notes for each of Versions 14, 13, and 12:
> 
> 
> From the change to this page I'd say v14:
> 
> https://www.postgresql.org/docs/14/plpgsql-statements.html
> 
> The release note for v14 say:
> 
> «
> PL/PgSQL: 
> Improve PL/pgSQL's expression and assignment parsing (Tom Lane)
> This change allows assignment to array slices and nested record fields.
> »

Thanks for the quick reply, David.

I looked at "43.5.1. Assignment" \
(https://www.postgresql.org/docs/14/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT).


I searched in the page for  « ].  » and found this:

complex_array[n].realpart = 12.3;

The corresponding page for Version 13 has no hits for  « ].  ». So that seems to be a \
clear answer to my question.


[Attachment #3 (unknown)]

<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: \
after-white-space;" class=""><i class=""></i><div class=""><i \
class=""></i></div><blockquote type="cite" class=""><div class=""><i class=""><a \
href="mailto:david.g.johnston@gmail.com" class="">david.g.johnston@gmail.com</a> \
wrote:<br class=""></i><br class=""><div class=""><blockquote type="cite" class=""><i \
class=""><a href="mailto:bryn@yugabyte.com" \
class="">bryn@yugabyte.com</a>&nbsp;wrote:</i><div class=""><br class="">I copied my \
testcase at the end. It runs OK and produces the output that I expect using PG \
Version 14.4. But using Version 11.9&nbsp;(and earlier 11 sub-versions), it fails to \
compile with this error:<br class=""><br class=""><font face="Courier New" \
class=""><span style="font-style: normal; font-size: 11px;" class=""><b \
class="">syntax error at or near "."<br class="">lhs[j].a := rhs[j].a;<br \
class="">&nbsp; &nbsp; &nbsp; ^<br class=""></b></span></font><br class=""></div><div \
class="">If I comment out the "Ideal approach" loop, then it runs fine in PG 11 and \
produces the same output as the "Ideal approach"&nbsp;does in PG 14,<br class=""><br \
class="">I looked at the Release Notes for each of Versions 14, 13, and 12:<br \
class=""></div></blockquote></div><div class=""><br class="">From the change to this \
page I'd say v14:<br class=""><br class=""><a \
href="https://www.postgresql.org/docs/14/plpgsql-statements.html" \
class="">https://www.postgresql.org/docs/14/plpgsql-statements.html</a><br \
class=""><br class="">The release note for v14 say:<br class=""><br \
class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: \
0px;" class=""><div class=""><div class=""> «</div></div><div class=""><div \
class="">PL/PgSQL:&nbsp;</div></div><div class=""><div class="">Improve PL/pgSQL's \
expression and assignment parsing (Tom Lane)</div></div><div class=""><div \
class="">This change allows assignment to array slices and nested record \
fields.</div></div><div class=""> »</div></blockquote></blockquote><blockquote \
style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""></blockquote><div \
class=""><br class="">Thanks for the quick reply, David.</div><div class=""><br \
class=""></div><div class="">I looked at "43.5.1. Assignment" (<a \
href="https://www.postgresql.org/docs/14/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT" \
class="">https://www.postgresql.org/docs/14/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT</a>).</div><div \
class=""><br class=""></div><div class="">I searched in the page for  « <font \
face="Courier New" class=""><span style="font-style: normal; font-size: 12px;" \
class=""><b class="">].</b></span></font>  » and found this:</div><div class=""><br \
class=""></div><div class=""><font face="Courier New" class=""><span \
style="font-style: normal; font-size: 11px;" class=""><b \
class="">complex_array[n].realpart = 12.3;</b></span></font></div><div class=""><br \
class=""></div><div class="">The corresponding page for Version 13 has no hits for  \
«&nbsp;<font face="Courier New" class=""><span style="font-size: 12px;" class=""><b \
class="">].</b></span></font>&nbsp; ». So that seems to be a clear answer to my \
question.</div><div class=""><br class=""></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic