From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Morgan Curley <mcurley(at)e4media(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Inserts in triggers |
Date: | 2001-07-25 15:31:49 |
Message-ID: | 21316.996075109@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Morgan Curley <mcurley(at)e4media(dot)com> writes:
> 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.
> 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 );
I think your problem is that this gets converted into something along
the line of
INSERT events ( $1, $2, ...) VALUES ( $1, $2, ...)
ie, the plpgsql parser is too stupid to know that it should substitute
values for only one set of occurrences of plpgsql variable names, and
not the other set. You could check this by running the function with
query logging turned on, and seeing what gets reported to the log.
Other than not using an INSERT target list, you could avoid this by
double-quoting the target list entries, or by not naming your plpgsql
variables the same as SQL columns you are referencing in your queries.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-07-25 15:43:06 | Re: Re: Inserts in triggers Follow Up |
Previous Message | Tom Lane | 2001-07-25 15:21:43 | Re: More.. Re: Changes to C interface from 7.0 to 7.1 |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-07-25 15:43:06 | Re: Re: Inserts in triggers Follow Up |
Previous Message | Josh Berkus | 2001-07-25 15:22:31 | Re: Meta integrity |