Обсуждение: COMPUTED BY fields or equivalent?
Hi all, I use Interbase (starting on PostgreSQL) which has a concept of CREATE TABLE My_Table ( First_Name VARCHAR(15), Last_Name VARCHAR(15), Full_Name VARCHAR(30) COMPUTED BY(First_Name || ' ' || Last_Name) } Full_Name is now a read only field in My_Table. Is there an equivalent in PostgreSQL. I would also be interested in hearing if this concept exists in other RDBMS's. TIA. Paul... -- plinehan x__AT__x yahoo x__DOT__x com C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro Please do not top-post.
Paul Ganainm <paulsnewsgroups@hotmail.com> writes:
> I use Interbase (starting on PostgreSQL) which has a concept of
> CREATE TABLE My_Table
> (
> First_Name VARCHAR(15),
> Last_Name VARCHAR(15),
> Full_Name VARCHAR(30) COMPUTED BY(First_Name || ' ' || Last_Name)
> }
You could do that with a view (if you don't want the derived field to be
physically stored on disk) or with a trigger (if you do).
regards, tom lane
tgl@sss.pgh.pa.us says... > > I use Interbase (starting on PostgreSQL) which has a concept of > > Full_Name VARCHAR(30) COMPUTED BY(First_Name || ' ' || Last_Name) > You could do that with a view (if you don't want the derived field to be > physically stored on disk) or with a trigger (if you do). Yes, indeed - and both of these solutions would work perfectly fine with Interbase/Firebird. I was just wondering if PostgreSQL implemented a COMPUTED BY feature or equivalent (as I said, I would also be curious about other RDBMS's). Thanks for your input so far. Paul... > regards, tom lane -- plinehan x__AT__x yahoo x__DOT__x com C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04 W2K Pro Please do not top-post.