Re: SELECT INTO returns incorrect values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bill Todd <pg(at)dbginc(dot)com>
Cc: PgSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT INTO returns incorrect values
Date: 2008-08-30 03:16:32
Message-ID: 7475.1220066192@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill Todd <pg(at)dbginc(dot)com> writes:
> The following SELECT INTO returns incorrect values in the variables
> CATEGORY_NAME and PARENT_ID. If I copy the SELECT statement to pgAdmin,
> delete the INTO clause and run the query it returns the correct values.

You didn't show us the whole function definition, so this is just
speculation, but I wonder whether any of the function's variable or
parameter names match any of the table column names used in the query.
For instance if you had a function parameter named CATEGORY or
CATEGORY_ID, you'd get surprising results because the value of that
parameter would get substituted for what you're thinking is a column
reference.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fernando Moreno 2008-08-30 04:01:11 Re: RAISE NOTICE format in pgAdmin
Previous Message Ron Mayer 2008-08-30 03:08:03 Re: Postgresql 8.3 statistic stadistinct value dead wrong even with default_statistics_target=1000