Re: [BUG?] Missing OID column from pl/pgsql record

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Saul, Jean Paolo" <paolo(dot)saul(at)verizonconnect(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG?] Missing OID column from pl/pgsql record
Date: 2019-07-16 02:50:28
Message-ID: 505.1563245428@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Saul, Jean Paolo" <paolo(dot)saul(at)verizonconnect(dot)com> writes:
> We recently upgraded to PostgreSQL 11. We have discovered an undocumented
> (or well-hidden) new behavior in pl/pgSQL.
> SELECT * INTO record variable does not include the OID column any more. All
> other system columns are still stored in the record variable.

Hmmm. TBH I think it's quite an accidental implementation artifact that
any of the underlying table's system columns get transmitted into the
record variable. It seems to happen only if you write exactly "select *",
or the table's exact column list, which probably means that it's tied
to the "physical tlist" optimization that the planner applies in such
cases. And that likely means it'll stop happening if there are any
dropped columns, to mention just one non-obvious problem case.

Between that and the fact that OID system columns are going away
entirely in v12, it's hard to muster any enthusiasm to mess with this.
I'd suggest explicitly selecting the OID, as you did in your non-failing
example.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Saul, Jean Paolo 2019-07-16 03:44:32 Re: [BUG?] Missing OID column from pl/pgsql record
Previous Message Peter Geoghegan 2019-07-16 02:01:58 Re: BUG #15896: pg_upgrade from 10-or-earlier: TRAP: FailedAssertion(»!(metad->btm_version >= 3)«