[postgis-users] Insert into

Nicolas Ribot nicolas.ribot at gmail.com
Tue Dec 18 10:59:45 PST 2012


Hi Bob,

The insert statement list only 3 columns. No other columns can be filled.

If your trigger function is intended to insert other columns values, then
you have to define an BEFORE INSERT.
An AFTER INSERT trigger cannot modify values, as insertion was already done.

Nicolas


On 18 December 2012 19:39, Bob Pawley <rjpawley at shaw.ca> wrote:

>   Maybe my mind has just gone numb – but I can’t figure out what is wrong.
>
> I run this expression
>
> insert into pipe(line, down, id)
>     (select st_makeline(st_centroid(num_search.the_geom7),
> st_endpoint(bob.edge_data.geom)),
>         st_makeline(st_centroid(num_search.the_geom7),
> st_endpoint(bob.edge_data.geom)), 1 --pipe_num
>     from bob.edge_data, num_search
>     where st_intersects(bob.edge_data.geom, num_search.the_geom7)
>     and num_search.seq = 1 );
>
> into this table
> CREATE TABLE public.pipe
> (
>   id integer,
>   line geometry,
>   face_id integer,
>   branch_point geometry,
>   branch integer,
>   up geometry,
>   up_done integer,
>   down geometry,
>   down_done integer,
>   right_ geometry,
>   right_done integer,
>   left_ geometry,
>   left_done integer
> )
> WITH (
>   OIDS=FALSE
> );
> ALTER TABLE public.pipe
>   OWNER TO postgres;
>
> -- Trigger: branch on public.pipe
>
> -- DROP TRIGGER branch ON public.pipe;
>
> CREATE TRIGGER branch
>   AFTER INSERT
>   ON public.pipe
>   FOR EACH ROW
>   EXECUTE PROCEDURE public.branch_point();
>
> The line column and the id column are inserted but the down column remains
> null.
>
> It’s and after insert trigger so I don’t think the trigger is stopping the
> column down insert.
>
> Any help would be appreciated.
>
> Bob
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121218/d7033789/attachment.html>


More information about the postgis-users mailing list