Received: from tolikus.hq.aaanet.ru (tolikus.hq.aaanet.ru [213.59.98.203]) by hub.org (8.10.1/8.10.1) with ESMTP id e5SAxE178923 for ; Wed, 28 Jun 2000 06:59:15 -0400 (EDT) Received: (from tolik@localhost) by tolikus.hq.aaanet.ru (8.9.3/8.9.3) id OAA07856; Wed, 28 Jun 2000 14:57:54 +0400 (MSD) (envelope-from tolik) To: "Emils Klotins" Cc: pgsql-sql@postgresql.org Subject: Re: trigger or something else? References: <3959EFA4.13956.28AD4E96@localhost> Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII From: tolik@aaanet.ru (Anatoly K. Lasareff) Date: 28 Jun 2000 14:57:53 +0400 In-Reply-To: "Emils Klotins"'s message of "Wed, 28 Jun 2000 12:29:24 +0200" Message-ID: <87bt0mkr7y.fsf@tolikus.hq.aaanet.ru> Lines: 46 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" X-Archive-Number: 200007/10 >>>>> "EK" == Emils Klotins writes: EK> Hello, EK> I have a table that has to have several fields with different names, EK> but equal content. Sounds stupid, but it is because I have 2 EK> different programs querying the same table for user information and EK> each of them uses differently named fields. EK> Eg. I have fields passwd and password. EK> When passwd field changes, password must automatically change EK> to be the same as passwd. EK> I was wondering whether I need a trigger for that, or could I EK> somehow manage to specify that in the "create table" stmt. EK> If I need to do it via trigger, then I apparently need the plpgsql, right? EK> Could you tell which configure option enables that? --enable- EK> plpgsql? EK> Thanks in advamce for any comments. EK> Emils I suppose you can use view for your need. For example: create table a ( l varchar(30), p varchar(30) ); create view b as select l as login, p as password from a; insert into a values ('qq', 'ww'); select * from b; tolik=# select * from b; login | password -------+---------- qq | ww (1 rows) Unfortunately this way suits for select only, not for 'insert into b' and 'update b' statement. -- Anatoly K. Lasareff Email: tolik@aaanet.ru