AW: Please advise features in 7.1

From: Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>
To: "'John Huttley'" <John(at)mwk(dot)co(dot)nz>, pgsql-hackers(at)postgresql(dot)org
Subject: AW: Please advise features in 7.1
Date: 2000-11-23 11:28:35
Message-ID: 11C1E6749A55D411A9670001FA687963368138@sdexcsrv1.f000.d0188.sd.spardat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> Reason: I want to know if any of these features are scheduled.
>
> 1. Calculated fields in table definitions . eg.
>
> Create table test (
> A Integer,
> B integer,
> the_sum As (A+B),
> );

This is currently easily done with a procedure that takes a tabletype parameter
with the name the_sum returning the sum of a + b.

Create table test (
A Integer,
B integer
);

create function the_sum (test) returns integer as
'
begin;
return ($1.a + $1.b);
end;
' language 'plpgsql';

A select * won't return the_sum, but a
select t.a, t.b, t.the_sum from test t;
will do what you want.

Unfortunately it only works if you qualify the column the_sum with a tablename or alias.
(But I heard you mention the Micro$oft word, and they tend to always use aliases anyway)
Maybe we could even extend the column search in the unqualified case ?

Andreas

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-11-23 11:49:53 Re: Please advise features in 7.1
Previous Message john huttley 2000-11-23 07:44:04 Re: Please advise features in 7.1