| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
|---|---|
| To: | 德哥 <digoal(at)126(dot)com> |
| Cc: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Re: BUG #16702: inline code and function : when use dynamic name for rowtype, there is some bug! |
| Date: | 2020-11-09 16:07:15 |
| Message-ID: | CAKFQuwYUuxmFUarSWWPV5ZfG8Mgf2MOy9CdV4Bpme2ScT0yf9A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Mon, Nov 9, 2020 at 6:50 AM 德哥 <digoal(at)126(dot)com> wrote:
> but the execution behavior is biased, either do not replace the value of
> the variable during the execution, but directly use the table name
> corresponding to the variable name.
>
I've lost something in translation. There is no bias (not sure what that
means in this context) or variability/ambiguity here. The thing in front
of %RowType is always an identifier - specifically, a table. That your
function also has a variable of the same name is immaterial to PostgreSQL
since none of the variables in the function are ever considered when it is
expecting/required-to-have an identifier to fulfill the syntax. This is
well-defined in PostgreSQL pl/pgsql and so the observed behavior is not
buggy.
"select tbl%rowtype into a%rowtype" is effectively (cast tbl%rowtype as
a%rowtype) which is a well-defined and the user is responsible for ensuring
the two rowtypes are compatible. "tbl" and "a" are compatible, "b" and "a"
are not, which your original post demonstrates.
David J.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heath Lord | 2020-11-09 17:07:53 | Re: REL_13_STABLE Windows 10 Regression Failures |
| Previous Message | Tom Lane | 2020-11-09 15:16:51 | Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint |