Re: Virtual generated columns

From: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Subject: Re: Virtual generated columns
Date: 2025-01-08 19:19:11
Message-ID: CAB-JLwZH-1f1E-idG_oFviRACELhhyAgq+J4m6KUzBNpe6cDGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 8 de jan. de 2025 às 13:14, Peter Eisentraut <peter(at)eisentraut(dot)org>
escreveu:

> Here is a new patch version where I have gathered various pieces of
> feedback and improvement suggestions that are scattered over this
> thread. I hope I got them all. I will respond to the respective
> messages directly to give my response to each item.
>

This new version you are not accepting subqueries, like previous ones. But
we can create an immutable SQL function which will do the same. Wouldn't it
be better to explain that on DOCs ?

create table Orders(Order_ID integer not null primary key, Customer_ID
integer references Customer);
create function lkCustomer(integer) returns text language sql immutable as
$function$select Name from Customer where Customer_ID = $1;$function$;
alter table Orders add lkCustomer text generated always as
(lkCustomer(Customer_ID)) stored;

regards
Marcos

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2025-01-08 19:23:35 Re: Virtual generated columns
Previous Message David Steele 2025-01-08 19:18:16 Re: Fwd: Re: A new look at old NFS readdir() problems?