From: Barbara Woolums <barb.woolums@ymail.com>
To: pgsql-performance@postgresql.org
Subject: Problem with query
Date: Sat, 15 Jan 2011 09:56:27 -0800 (PST)
Message-ID: <969645.11215.qm@web111812.mail.gq1.yahoo.com> (raw)
Hi there,
Could someone please tell me why the following query won't work
select DISTINCT get_unit(unit) as unit, get_ingredient(ing) as ing,
get_ing_aisle(1,ing) as aisle
from recipe_ing where recipe in(1084, 1086, 1012, 618) and qtydec>0 and ing not
in(select ing from excluded_ing where owner=1)
order by aisle
the query returns the following with no values for aisle, but there should be
some.
"c";"Pumpkin Seeds";""
"tb";"Horseradish";""
"c";"Puffed Quinoa";""
"c";"Honey";""
"c";"sesame seeds";""
"";"Red Onion";""
"ts";"Spicy Mustard";""
"c";"Dry Oatmeal";""
"c";"Ketchup";""
"ts";"Pepper";""
"tb";"Brown Sugar";""
"c";"Pecans";""
"ts";"Dijon Mustard";""
"single";"Cadbury Flake Bar";""
"g";"Caster Sugar";""
"g";"Low-fat Mozzarella Cheese";""
"md";"Onion";""
"sm";"Whole-wheat Pita";""
"medium";"Lemon";""
"c";"Raisins";""
"c";"Almonds";""
"c";"Dates";""
"g";"Ham";""
"lb";"Ground Sirloin";""
"c";"Shredded Coconut";""
"c";"Sunflower Seeds";""
"";"Tomato";""
The function used to extract aisle is
CREATE OR REPLACE FUNCTION get_ing_aisle(bigint, bigint)
RETURNS character AS
'SELECT get_aisle(aisle) as aisle FROM ingredient_owner WHERE ingredient=$1 and
owner=$2'
LANGUAGE 'sql' VOLATILE
COST 100;
Cheers
Barb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: barb.woolums@ymail.com
Subject: Re: Problem with query
In-Reply-To: <969645.11215.qm@web111812.mail.gq1.yahoo.com>
References: <969645.11215.qm@web111812.mail.gq1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox