Re: [GENERAL] update with from

2012-01-24 Thread Adrian Klaver
On Monday, January 23, 2012 10:11:00 pm Sim Zacks wrote: > On 01/23/2012 07:10 PM, Adrian Klaver wrote: > > On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: > >> On 01/23/2012 05:13 PM, Adrian Klaver wrote: > >> > >> > >> When I throw in code to make the select only return the correct rows

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 07:10 PM, Adrian Klaver wrote: > On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: >> On 01/23/2012 05:13 PM, Adrian Klaver wrote: > >> >> When I throw in code to make the select only return the correct rows >> The select statement takes 9 secs by itself: >> select a.partid,a.d

Re: [GENERAL] update with from

2012-01-23 Thread Adrian Klaver
On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: > On 01/23/2012 05:13 PM, Adrian Klaver wrote: > > When I throw in code to make the select only return the correct rows > The select statement takes 9 secs by itself: > select a.partid,a.deliverywks > from poparts a where popartid in ( >

Re: [GENERAL] update with from

2012-01-23 Thread Adrian Klaver
On Monday, January 23, 2012 7:32:35 am Sim Zacks wrote: > On 01/23/2012 05:13 PM, Adrian Klaver wrote: > > I guess the primary question here is, what are you trying to achieve? > > Do want a particular row to supply the values to the target table i.e the > > row with the most timestamp? > > What is

Re: [GENERAL] update with from

2012-01-23 Thread Tom Lane
Sim Zacks writes: > I want to update a table with a from that has mutliple rows joining to > it. According to the docs, this is not advisable because: > "If it does, then only one of the join rows will be used to update the > target row, but which one will be used is not readily predictable." Th

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 05:13 PM, Adrian Klaver wrote: > > I guess the primary question here is, what are you trying to achieve? > Do want a particular row to supply the values to the target table i.e the row > with the most timestamp? > What is the query you are using? > The query returns a partid, unit

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
On 01/23/2012 04:34 PM, Alban Hertroys wrote: > On 23 January 2012 14:48, Sim Zacks wrote: >>> In my tests, if the joined rows are sorted it always updates with the >>> first row. Does anyone have any other experiences, or should I be >>> concerned that at some point it will behave differently? >>

Re: [GENERAL] update with from

2012-01-23 Thread Adrian Klaver
On Monday, January 23, 2012 2:00:29 am Sim Zacks wrote: > Postgresql 8.2 > > I want to update a table with a from that has mutliple rows joining to > it. According to the docs, this is not advisable because: > "If it does, then only one of the join rows will be used to update the > target row, bu

Re: [GENERAL] update with from

2012-01-23 Thread Alban Hertroys
On 23 January 2012 14:48, Sim Zacks wrote: >> In my tests, if the joined rows are sorted it always updates with the >> first row. Does anyone have any other experiences, or should I be >> concerned that at some point it will behave differently? > > I checked my tests again. It always uses the last

Re: [GENERAL] update with from

2012-01-23 Thread Sim Zacks
> In my tests, if the joined rows are sorted it always updates with the > first row. Does anyone have any other experiences, or should I be > concerned that at some point it will behave differently? I checked my tests again. It always uses the last one, not the first one. Sim -- Sent via pgsql

[GENERAL] update with from

2012-01-23 Thread Sim Zacks
Postgresql 8.2 I want to update a table with a from that has mutliple rows joining to it. According to the docs, this is not advisable because: "If it does, then only one of the join rows will be used to update the target row, but which one will be used is not readily predictable." In my tests,