Re: parse error at or near $1 - Mailing list pgsql-general

From Tom Lane
Subject Re: parse error at or near $1
Date
Msg-id 23502.987517494@sss.pgh.pa.us
Whole thread Raw
In response to parse error at or near $1  (Michael McDonnell <michael@winterstorm.ca>)
List pgsql-general
Michael McDonnell <michael@winterstorm.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: index not used with subselect in where clause ?
Next
From: Tom Lane
Date:
Subject: Re: local security