Re: How to use outer join in update

From: "Shoaib Mir" <shoaibmir(at)gmail(dot)com>
To: "Alban Hertroys" <alban(at)magproductions(dot)nl>
Cc: Andrus <kobruleht2(at)hot(dot)ee>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to use outer join in update
Date: 2006-12-08 09:17:46
Message-ID: bf54be870612080117t7c1676e7v184e2b09352fbfdc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

You can use a view for that join query and then create a rule over it to
insert in the referenced tables for the inserts in view.

Thanks,
Shoaib

On 12/8/06, Alban Hertroys <alban(at)magproductions(dot)nl> wrote:
>
> Andrus wrote:
> > In my current DBMS I can use
> >
> > create table t1 ( f1 int, f2 int );
> > create table t2 ( f3 int, f4 int );
> > update t1 set f1=t2.f3 from t1 left join t2 on t1.f2=t2.f4
>
> That looks like a self-join on t1 without using an alias for the second
> instance of t1.
>
> I think you meant:
> update t1 set f1=t2.f3 from t2 where f2 = t2.f4
>
> --
> Alban Hertroys
> alban(at)magproductions(dot)nl
>
> magproductions b.v.
>
> T: ++31(0)534346874
> F: ++31(0)534346876
> M:
> I: www.magproductions.nl
> A: Postbus 416
> 7500 AK Enschede
>
> // Integrate Your World //
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stéphane Schildknecht 2006-12-08 09:33:17 Excluding schema from backup
Previous Message Michael Glaesemann 2006-12-08 09:10:35 Re: