From: tolik@aaanet.ru
To: Emils Klotins <emils@dot.lv>
Cc: pgsql-sql@postgresql.org
Subject: Re: trigger or something else?
Date: 28 Jun 2000 14:57:53 +0400
Message-ID: <87bt0mkr7y.fsf@tolikus.hq.aaanet.ru> (raw)
References: <3959EFA4.13956.28AD4E96@localhost>
>>>>> "EK" == Emils Klotins <emils@dot.lv> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tolik@aaanet.ru, emils@dot.lv
Subject: Re: trigger or something else?
In-Reply-To: <87bt0mkr7y.fsf@tolikus.hq.aaanet.ru>
References: <3959EFA4.13956.28AD4E96@localhost> <87bt0mkr7y.fsf@tolikus.hq.aaanet.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox