Thanks All,
And thanks Tom, I did not realise a rule worked in that manner. Will now
take that into account in the future.
Thanks
Andrew
On 26 July 2013 02:02, Giuseppe Broccolo
wrote:
>
> Unrelated to the OP's question, the suggestion above could be more simply
>> rewritten as
>>
>> TG_OP
Unrelated to the OP's question, the suggestion above could be more
simply rewritten as
TG_OP = 'UPDATE'
AND NEW.b IS DISTINCT FROM OLD.b
You're right! :)
Giuseppe.
--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe.brocc...@2ndquadrant.it | www.2ndQu
On Thu, Jul 25, 2013 at 4:18 AM, Giuseppe Broccolo <
giuseppe.brocc...@2ndquadrant.it> wrote:
> (TG_OP = 'UPDATE' AND
> (NEW.b != OLD.b OR
> (NEW.b IS NULL AND OLD.b IS NOT NULL) OR
> (NEW.b IS NOT NULL AND OLD.b IS NULL)
>
On Thu, Jul 25, 2013 at 3:02 PM, Tom Lane wrote:
> Luca Ferrari writes:
>> The original post was related to the update of b, so I guess it is
>> better to limit the trigger scope to update on such column:
>
>> CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS
>> $mirror$
>> BEGIN
>> NEW
Luca Ferrari writes:
> The original post was related to the update of b, so I guess it is
> better to limit the trigger scope to update on such column:
> CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS
> $mirror$
> BEGIN
> NEW.a = NEW.b;
> RETURN NEW;
> END;
> $mirror$ LANGUAGE plp
The original post was related to the update of b, so I guess it is
better to limit the trigger scope to update on such column:
CREATE OR REPLACE FUNCTION b_mirror() RETURNS TRIGGER AS
$mirror$
BEGIN
NEW.a = NEW.b;
RETURN NEW;
END;
$mirror$ LANGUAGE plpgsql;
CREATE TRIGGER tr_b_mirror AFTER
I am trying to do something like this
create table cats (a text,b text);
create rule cats_test as on update to cats do set a = new.b;
Can i manipulate column "a" sort of like this... or is there a
better way.
I think the easiest way to do this is to use a trigger like this:
CREATE FUNCTI
On Thu, Jul 25, 2013 at 8:44 AM, Andrew Bartley wrote:
> create rule cats_test as on update to cats do set a = new.b;
>
I would use a column trigger attached to the 'a' column. Rules are
better for query rewriting rather than from semantic changes.
That's my opinion.
Luca
--
Sent via pgsql-g
On Wed, Jul 24, 2013 at 11:44 PM, Andrew Bartley wrote:
> Hope this question is not too stupid but..
>
> I am trying to do something like this
>
> create table cats (a text,b text);
>
> create rule cats_test as on update to cats do set a = new.b;
>
> Can i manipulate column "a" sort of like th
On Fri, Feb 29, 2008 at 4:08 AM, Tim Rupp <[EMAIL PROTECTED]> wrote:
> One other question. If the lock needed is exclusive, and more inserts
> come in after it is requested, will Postgres schedule the rule to be
> created before those new inserts are allowed to happen? Or can the rule
> reques
Klint Gore wrote:
[see below or the top posting police will arrive on my doorstep :)]
Devi wrote:
Hi,
CREATE RULE dosen't require any lock. It is carried out in the parser
level. But there will be ACCESS SHARE lock over the tables which are
being queried & are acquired automatically.
Tha
[see below or the top posting police will arrive on my doorstep :)]
Devi wrote:
Hi,
CREATE RULE dosen't require any lock. It is carried out in the parser
level. But there will be ACCESS SHARE lock over the tables which are
being queried & are acquired automatically.
Thanks
DEVI.G
- Or
Hi,
CREATE RULE dosen't require any lock. It is carried out in the parser
level. But there will be ACCESS SHARE lock over the tables which are being
queried & are acquired automatically.
Thanks
DEVI.G
- Original Message -
From: "Tim Rupp" <[EMAIL PROTECTED]>
To:
Sent: Friday, Feb
13 matches
Mail list logo