Re: Inserts in triggers

From: "Richard Huxton" <dev(at)archonet(dot)com>
To: <pgsql-general(at)postgresql(dot)org>, <pgsql-sql(at)postgresql(dot)org>, "Morgan Curley" <mcurley(at)e4media(dot)com>
Subject: Re: Inserts in triggers
Date: 2001-07-25 08:56:35
Message-ID: 009301c114e7$dd2e8960$1001a8c0@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

From: "Morgan Curley" <mcurley(at)e4media(dot)com>

> Are there server setting that need to be set in order to do inserts from
> trigger functions?

Don't think so. Triggers run with the permissions of the creator, not the
caller though so you might want to look into that.

> I keep getting: ERROR: parser: parse error at or near "$1"
> and the DEBUG log entry points to the line with the insert on it.
> i.e.

Could you quote a few lines of code either side - especially something with
the $1

> INSERT events ( event_id, sport_id ,name ,feed_code, start_time,
> active_flag, create_timestamp, update_timestamp ) VALUES ( event_id
> ,sport_id ,feed_code ,feed_code, create_timestamp, 1, create_timestamp,
> create_timestamp );
>
> where the values list is a list of predefined vars.

Well it should be INSERT INTO ... but I presume this is a cut & paste issue.

So you have variable names the same as all the field names? I'd probably
change them (stick v_ on the front or something). Even if plpgsql doesn't
get confused readers will.

- Richard Huxton

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Peltonen 2001-07-25 09:35:29 7.1.1: pgdump fails
Previous Message Dr. Evil 2001-07-25 07:39:21 More.. Re: Changes to C interface from 7.0 to 7.1

Browse pgsql-sql by date

  From Date Subject
Next Message Morgan Curley 2001-07-25 13:09:54 Re: Inserts in triggers Follow Up
Previous Message Florian Weimer 2001-07-25 07:17:23 Re: Determining if two subnets intersect