Re: [GENERAL] Using Insert with case

2012-08-07 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Bob Pawley Sent: Tuesday, August 07, 2012 6:26 PM To: Postgresql Subject: [GENERAL] Using Insert with case Hi   select case when somevariable = 2     then (insert into pipe (line)     select

Re: [GENERAL] Using Insert with case

2012-08-07 Thread Bob Pawley
] Using Insert with case On 8 Aug 2012, at 24:26, Bob Pawley wrote: Hi select case when somevariable = 2 then (insert into pipe (line) select bob.edge_data.edge_id from bob.edge_data, bob.node, pipe where st_intersects(st_startpoint(bob.edge_data.geom), bob.node.geom

Re: [GENERAL] Using Insert with case

2012-08-07 Thread Alban Hertroys
On 8 Aug 2012, at 24:26, Bob Pawley wrote: > Hi > > select > case when somevariable = 2 > then (insert into pipe (line) > select bob.edge_data.edge_id > from bob.edge_data, bob.node, pipe > where st_intersects(st_startpoint(bob.edge_data.geom), bob.node.geom) >

Re: [GENERAL] Using Insert with case

2012-08-07 Thread Chris Angelico
On Wed, Aug 8, 2012 at 8:26 AM, Bob Pawley wrote: > Hi > > select > case when somevariable = 2 > then (insert into pipe (line) ... > > I am attempting to use the above. However, with or without the enclosing > brackets I get a syntax error on the word into. Utterly untested, but does it work

[GENERAL] Using Insert with case

2012-08-07 Thread Bob Pawley
Hi select case when somevariable = 2 then (insert into pipe (line) select bob.edge_data.edge_id from bob.edge_data, bob.node, pipe where st_intersects(st_startpoint(bob.edge_data.geom), bob.node.geom) and bob.node.node_id = 415 and pipe.id = 1) I am att