@@ -354,14 +354,6 @@ pub struct SubscriptionPlan {
354354 return_id : TableId ,
355355 /// To which table are we subscribed?
356356 return_name : TableName ,
357- /// Are we subscribed to a view?
358- is_view : bool ,
359- /// The number of columns returned.
360- /// Only relevant for views.
361- num_cols : usize ,
362- /// The number of private columns returned.
363- /// Only relevant for views.
364- num_private_cols : usize ,
365357 /// A subscription can read from multiple tables.
366358 /// From which tables do we read?
367359 table_ids : Vec < TableId > ,
@@ -385,19 +377,25 @@ impl SubscriptionPlan {
385377
386378 /// Does this plan return rows from a view?
387379 pub fn is_view ( & self ) -> bool {
388- self . is_view
380+ self . plan_opt . returns_view_table ( )
389381 }
390382
391383 /// The number of columns returned.
392384 /// Only relevant if [`Self::is_view`] is true.
393385 pub fn num_cols ( & self ) -> usize {
394- self . num_cols
386+ self . plan_opt
387+ . return_table ( )
388+ . map ( |schema| schema. num_cols ( ) )
389+ . unwrap_or_default ( )
395390 }
396391
397392 /// The number of private columns returned.
398393 /// Only relevant if [`Self::is_view`] is true.
399394 pub fn num_private_cols ( & self ) -> usize {
400- self . num_private_cols
395+ self . plan_opt
396+ . return_table ( )
397+ . map ( |schema| schema. num_private_cols ( ) )
398+ . unwrap_or_default ( )
401399 }
402400
403401 /// To which table does this plan subscribe?
@@ -558,26 +556,13 @@ impl SubscriptionPlan {
558556 bail ! ( "Subscriptions require indexes on join columns" )
559557 }
560558
561- let is_view = plan_opt. returns_view_table ( ) ;
562- let num_cols = plan_opt
563- . return_table ( )
564- . map ( |schema| schema. num_cols ( ) )
565- . unwrap_or_default ( ) ;
566- let num_private_cols = plan_opt
567- . return_table ( )
568- . map ( |schema| schema. num_private_cols ( ) )
569- . unwrap_or_default ( ) ;
570-
571559 let ( table_ids, table_aliases) = table_ids_for_plan ( & plan) ;
572560
573561 let fragments = Fragments :: compile_from_plan ( & plan, & table_aliases, auth) ?;
574562
575563 subscriptions. push ( Self {
576564 return_id,
577565 return_name : return_name. clone ( ) ,
578- is_view,
579- num_cols,
580- num_private_cols,
581566 table_ids,
582567 plan_opt,
583568 fragments,
0 commit comments