Re: SELECT INTO returns incorrect values

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
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-09-03 19:54:52
Message-ID: 48BEEB8C.6010309@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Bill,
Did you try it like this:

parent_id = 0
category_name = ''
select category, parent_category_id
from note.category
where category_id = 477 into category_name, parent_id;
raise notice 'curr cat, name, parent id: % % ', category_name,
parent_id;

I have found in the past that it's a good idea to initialize your vars
before you use them in PL/pgsql.

Also as a FYI, you don't need to upper case all your text in a function
(I know you have to do that in Firebird), just use standard case with
normal capitalization because
PostgreSQL will lowercase everything you send to the server that is not
in quotes. It's a lot easier to read without the uppercase.

Later,

Tony Caduto
AM Software Design
Home of Lightning Admin for PostgreSQL
http://www.amsoftwaredesign.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message William Garrison 2008-09-03 19:55:17 Re: Simple query not using index: why?
Previous Message Ian Harding 2008-09-03 19:14:43 Re: hash partitioning