I've trimmed this query down as much as possible (started out much
larger), it no longer causes the error.


PREPARE "pg_psql_dd2"(text,text) AS 
SELECT true
FROM (
  SELECT true
  FROM pg_catalog.pg_proc p,
       pg_catalog.pg_name_pattern( $2 ) AS (schpat text, propat text)
  WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
) AS tt,
  (SELECT $1 AS cmd) AS cmd;

ERROR:  Parameter '$1' is out of range


-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc
28 Jan 2003 23:39:50 -0500
Rod Taylor <rbt@rbt.ca>
Strange Prepare bug
Rod Taylor <rbt@rbt.ca> writes:
> PREPARE "pg_psql_dd2"(text,text) AS=20
> SELECT true
> FROM (
>   SELECT true
>   FROM pg_catalog.pg_proc p,
>        pg_catalog.pg_name_pattern( $2 ) AS (schpat text, propat text)
>   WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
> ) AS tt,
>   (SELECT $1 AS cmd) AS cmd;

> ERROR:  Parameter '$1' is out of range

I get

ERROR:  Function pg_catalog.pg_name_pattern(text) does not exist

It could be the error is inside your custom function?

			regards, tom lane

Wed, 29 Jan 2003 02:37:31 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Strange Prepare bug 
> I get
> 
> ERROR:  Function pg_catalog.pg_name_pattern(text) does not exist
> 
> It could be the error is inside your custom function?

I forgot that is a new function :)


Try this one:

PREPARE "pg_psql_dd2"(text,text) AS 
SELECT true
FROM (
  SELECT true
  FROM pg_catalog.pg_proc p,
       (SELECT substr($2, 1, 3) as schpat, substr($2, 3, 5) as propat)
as t
  WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
) AS tt,
  (SELECT $1 AS cmd) AS cmd

-- 
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc
29 Jan 2003 07:52:29 -0500
Rod Taylor <rbt@rbt.ca>
Re: Strange Prepare bug