Re: parse error at or near $1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael McDonnell <michael(at)winterstorm(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: parse error at or near $1
Date: 2001-04-17 14:24:54
Message-ID: 23502.987517494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael McDonnell <michael(at)winterstorm(dot)ca> writes:
> And when I run "SELECT contactable_name(1);" I get the error message
> "parse error at or near $1".

$1 is a parameter placeholder; probably your problem is unexpected
substitution (or lack of substitution) of a plplgsql variable or
parameter into a query that's being sent to the underlying SQL engine.

In 7.1 the easiest way to debug this type of problem is to do
SET debug_print_query TO 1;
then execute the problem function call, and then look in the postmaster
log to see what queries got generated by the function. In older PG
versions there is no debug_print_query variable, so you have to resort
to setting environment variable PGOPTIONS to "-d2" before starting psql
to get query logging.

plpgsql needs more support for debugging --- some kind of trace
mechanism that doesn't require access to the postmaster log would be
awfully nice ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rini Dutta 2001-04-17 14:28:53 drastic reduction in speed of inserts as the table grows
Previous Message Tom Lane 2001-04-17 14:16:14 Re: local security