pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedproblem with view in 7.3
4+ messages / 2 participants
[nested] [flat]
* problem with view in 7.3
@ 2002-12-03 14:48 Alphasoft <ico@alphasoft-bg.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alphasoft @ 2002-12-03 14:48 UTC (permalink / raw)
To: pgsql-sql
Hi , I am Hristo Neshev From Bulgaria
In Version 7.2 this statement works :
create view v_impr_check
(
ead_no,
ead_date,
e_no,
e_date,
sid,
number,
s_order,
cdt,
cdt_description,
original_qty,
used_qty,
waste_qty,
rest_qty,
original_used_qty
)
AS
select distinct md_custom_number,
md_custom_date,
md_number ,
md_date ,
sni_sid ,
sni_number ,
snig_ord_number_in,
cdt_part_number,
cdt_description,
snig_quantity,
(select sum(impo_quantity) from impr_out where impo_store_note_in = snig_store_note_in and impo_ord_number_in = snig_ord_number_in),
(select sum(impow_quantity) from impr_out_waste where impow_store_note_in= sni_sid and impow_ord_number_in = snig_ord_number_in),
(select sum(iwnog_quantity) from impr_waste_note_out_goods where iwnog_store_note_in = sni_sid and iwnog_ord_number_in = snig_ord_number_in and iwnog_impr_note_out not in (select impow_iwnog_impr_note_out from impr_out_waste where impow_iwnog_impr_note_out is not null) ),
snig_used_quantity
from
store_note_in join md_header on md_sni_sid = sni_sid
join store_note_in_goods join commodity on (snig_commodity = cdt_sid)
on sni_sid = snig_store_note_in
Where
sni_type_doc = 303;
In 7.3 when i am trying to recreate the view I received the folowing error :
find_expr_references_walker: bogus varno 8
The problem is in subselect statements
^ permalink raw reply [nested|flat] 4+ messages in thread
* problem with view in 7.3
@ 2002-12-03 15:04 Alphasoft <ico@alphasoft-bg.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alphasoft @ 2002-12-03 15:04 UTC (permalink / raw)
To: pgsql-sql
Hi , I am Hristo Neshev From Bulgaria
In Version 7.2 this statement works :
create view v_impr_check
(
ead_no,
ead_date,
e_no,
e_date,
sid,
number,
s_order,
cdt,
cdt_description,
original_qty,
used_qty,
waste_qty,
rest_qty,
original_used_qty
)
AS
select distinct md_custom_number,
md_custom_date,
md_number ,
md_date ,
sni_sid ,
sni_number ,
snig_ord_number_in,
cdt_part_number,
cdt_description,
snig_quantity,
(select sum(impo_quantity) from impr_out where impo_store_note_in = snig_store_note_in and impo_ord_number_in = snig_ord_number_in),
(select sum(impow_quantity) from impr_out_waste where impow_store_note_in= sni_sid and impow_ord_number_in = snig_ord_number_in),
(select sum(iwnog_quantity) from impr_waste_note_out_goods where iwnog_store_note_in = sni_sid and iwnog_ord_number_in = snig_ord_number_in and iwnog_impr_note_out not in (select impow_iwnog_impr_note_out from impr_out_waste where impow_iwnog_impr_note_out is not null) ),
snig_used_quantity
from
store_note_in join md_header on md_sni_sid = sni_sid
join store_note_in_goods join commodity on (snig_commodity = cdt_sid)
on sni_sid = snig_store_note_in
Where
sni_type_doc = 303;
In 7.3 when i am trying to recreate the view I received the folowing error :
find_expr_references_walker: bogus varno 8
The problem is in subselect statements
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: problem with view in 7.3
@ 2002-12-03 15:18 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alphasoft <ico@alphasoft-bg.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2002-12-03 15:18 UTC (permalink / raw)
To: Alphasoft <ico@alphasoft-bg.com>; +Cc: pgsql-sql
"Alphasoft" <ico@alphasoft-bg.com> writes:
> In 7.3 when i am trying to recreate the view I received the folowing error :
> find_expr_references_walker: bogus varno 8=20
This is a bug, but I can't fix it unless you give me a complete test
case. I don't have time to try to reverse-engineer your schema...
"pg_dump -s" is a quick way to make a script that just creates your
tables without any data.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: problem with view in 7.3
@ 2002-12-04 20:02 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alphasoft <ico@alphasoft-bg.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2002-12-04 20:02 UTC (permalink / raw)
To: Alphasoft <ico@alphasoft-bg.com>; +Cc: pgsql-sql
"Alphasoft" <ico@alphasoft-bg.com> writes:
> In 7.3 when i am trying to recreate the view I received the folowing error :
> find_expr_references_walker: bogus varno 8
Found it --- thanks for the test case. The patch is attached, if you
want to apply it locally.
regards, tom lane
inline patch 1: src/backend/catalog/dependency.c (+6/-0 lines) download inline-1.patch
*** src/backend/catalog/dependency.c.orig Sat Sep 21 20:37:09 2002
--- src/backend/catalog/dependency.c Wed Dec 4 14:45:58 2002
***************
*** 789,794 ****
--- 789,799 ----
else if (rte->rtekind == RTE_JOIN)
{
/* Scan join output column to add references to join inputs */
+ List *save_rtables;
+
+ /* We must make the context appropriate for join's level */
+ save_rtables = context->rtables;
+ context->rtables = rtables;
if (var->varattno <= 0 ||
var->varattno > length(rte->joinaliasvars))
elog(ERROR, "find_expr_references_walker: bogus varattno %d",
***************
*** 796,801 ****
--- 801,807 ----
find_expr_references_walker((Node *) nth(var->varattno - 1,
rte->joinaliasvars),
context);
+ context->rtables = save_rtables;
}
return false;
}
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2002-12-04 20:02 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-03 14:48 problem with view in 7.3 Alphasoft <ico@alphasoft-bg.com>
2002-12-04 20:02 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-12-03 15:04 problem with view in 7.3 Alphasoft <ico@alphasoft-bg.com>
2002-12-03 15:18 ` Tom Lane <tgl@sss.pgh.pa.us>
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