Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: jian he <jian.universality@gmail.com>
Cc: Feike Steenbergen <feikesteenbergen@gmail.com>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2025-06-25T08:11:28Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Restrict virtual columns to use built-in functions and types

  2. Fix virtual generated column type checking for ALTER TABLE

  3. Expand virtual generated columns in the planner

On 23.06.25 15:13, Peter Eisentraut wrote:
> Your CheckAttributeType() change is conditional on TYPTYPE_BASE, but if 
> you remove that and check it for all types, then you get the right error 
> in both cases.
> 
> I have attached a patch that is similar to yours but with that change. 
> I've also written the test cases a bit differently, but it also covers 
> everything now.
> 
> (The two patches should be squashed.  I'm just keeping them separate to 
> show what is changed.)

This has been committed thus.  This should close this topic.